Browse Source

Adding missing property and fixing typos

Jose Lorenzo Rodriguez 11 years ago
parent
commit
56a6e4f863

+ 12 - 5
src/ORM/Rule/ExistsIn.php

@@ -23,21 +23,28 @@ use Cake\Datasource\EntityInterface;
 class ExistsIn {
 
 /**
+ * The list of fields to check
+ *
+ * @var array
+ */
+	protected $_fields;
+
+/**
  * Constructor.
  *
- * @param string $field The field to check existance for.
+ * @param string|array $fields The field or fields to check existance as primary key.
  * @param object|string $repository The repository where the field will be looked for,
  * or the association name for the repository.
  */
-	public function __construct($field, $repository) {
-		$this->_field = $field;
+	public function __construct($fields, $repository) {
+		$this->_field = (array)$fields;
 		$this->_repository = $repository;
 	}
 
 /**
  * Performs the existance check
  *
- * @param \Cake\Datasource\EntityInterface $entity The entity form where to extract the fields
+ * @param \Cake\Datasource\EntityInterface $entity The entity from where to extract the fields
  * @param array $options Options passed to the check,
  * where the `repository` key is required.
  */
@@ -48,7 +55,7 @@ class ExistsIn {
 
 		$conditions = array_combine(
 			(array)$this->_repository->primaryKey(),
-			$entity->extract((array)$this->_field)
+			$entity->extract($this->_fields)
 		);
 		return $this->_repository->exists($conditions);
 	}

+ 1 - 1
src/ORM/Rule/IsUnique.php

@@ -40,7 +40,7 @@ class IsUnique {
 /**
  * Performs the uniqueness check
  *
- * @param \Cake\Datasource\EntityInterface $entity The entity form where to extract the fields
+ * @param \Cake\Datasource\EntityInterface $entity The entity from where to extract the fields
  * @param array $options Options passed to the check,
  * where the `repository` key is required.
  */

+ 1 - 1
src/ORM/RulesChecker.php

@@ -19,7 +19,7 @@ use Cake\ORM\Rule\IsUnique;
 use Cake\ORM\Rule\ExistsIn;
 
 /**
- * Contains logic for storing and checking domain rules on entities
+ * Contains logic for storing and checking rules on entities
  *
  */
 class RulesChecker {

+ 1 - 1
tests/TestCase/ORM/RulesCheckerIntegrationTest.php

@@ -19,7 +19,7 @@ use Cake\ORM\TableRegistry;
 use Cake\TestSuite\TestCase;
 
 /**
- * Tests the integration between the ORM and the doamin rules cheker
+ * Tests the integration between the ORM and the doamin checker
  */
 class RulesCheckerIntegrationTest extends TestCase {