diff --git a/cake/console/libs/templates/objects/model.ctp b/cake/console/libs/templates/objects/model.ctp index 5cb28dc9c..06b2ca22e 100644 --- a/cake/console/libs/templates/objects/model.ctp +++ b/cake/console/libs/templates/objects/model.ctp @@ -21,6 +21,7 @@ */ echo " + class extends AppModel { var $name = ''; @@ -32,11 +33,11 @@ class extends AppModel { $table = 'false'; endif; echo "\tvar \$useTable = $table;\n"; -endif; ?> - +endif; +if ($primaryKey !== 'id'): ?> var $primaryKey = ''; - - $validations): @@ -47,7 +48,11 @@ if (!empty($validate)): echo "\t\t),\n"; endforeach; echo "\t);\n"; -endif; +endif; + +?> + //The Associations below have been created with all possible keys, those that are not needed can be removed + +} '; ?> diff --git a/cake/tests/cases/console/libs/tasks/model.test.php b/cake/tests/cases/console/libs/tasks/model.test.php index d66a6c9d3..7ae9b592e 100644 --- a/cake/tests/cases/console/libs/tasks/model.test.php +++ b/cake/tests/cases/console/libs/tasks/model.test.php @@ -547,6 +547,7 @@ class ModelTaskTest extends CakeTestCase { $pattern = '/' . preg_quote("'notempty' => array('rule' => array('notempty')),", '/') . '/'; $this->assertPattern($pattern, $result); } + /** * test baking relations *