Skip to content

Commit

Permalink
Restoring primary key validation
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed May 18, 2014
1 parent cee14ac commit ad3f08a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Console/Command/Task/ModelTask.php
Expand Up @@ -411,7 +411,7 @@ public function getValidation($model) {
* @return array Array of validation for the field.
*/
public function fieldValidation($fieldName, array $metaData, $primaryKey) {
$ignoreFields = array_merge($primaryKey, ['created', 'modified', 'updated']);
$ignoreFields = ['created', 'modified', 'updated'];
if (in_array($fieldName, $ignoreFields)) {
return false;
}
Expand Down
4 changes: 3 additions & 1 deletion tests/TestCase/Console/Command/Task/ModelTaskTest.php
Expand Up @@ -427,6 +427,7 @@ public function testGetValidation() {
'title' => ['rule' => false, 'allowEmpty' => false],
'body' => ['rule' => false, 'allowEmpty' => true],
'published' => ['rule' => 'boolean', 'allowEmpty' => true],
'id' => ['rule' => 'numeric', 'allowEmpty' => 'create']
];
$this->assertEquals($expected, $result);

Expand All @@ -436,7 +437,8 @@ public function testGetValidation() {
'bake_article_id' => ['rule' => 'numeric', 'allowEmpty' => false],
'bake_user_id' => ['rule' => 'numeric', 'allowEmpty' => false],
'comment' => ['rule' => false, 'allowEmpty' => true],
'published' => ['rule' => false,'allowEmpty' => true]
'published' => ['rule' => false,'allowEmpty' => true],
'otherid' => ['rule' => 'numeric', 'allowEmpty' => 'create']
];
$this->assertEquals($expected, $result);
}
Expand Down

0 comments on commit ad3f08a

Please sign in to comment.