Skip to content
Permalink
Browse files

Flush TableRegistry when generating controllers/models.

Because tests will attach any and all associations, we need to flush the
registry in all() commands. This flushes out belongsToMany associations
that have also generated hasMany associations to their parent tables.

Refs #4143
  • Loading branch information...
markstory committed Sep 25, 2014
1 parent 52d40a2 commit 97e1e1bfee36986173b2f7792d65672438c1db23
Showing with 2 additions and 0 deletions.
  1. +1 −0 src/Shell/Task/ControllerTask.php
  2. +1 −0 src/Shell/Task/ModelTask.php
@@ -67,6 +67,7 @@ public function main($name = null) {
*/
public function all() {
foreach ($this->listAll() as $table) {
TableRegistry::clear();
$this->main($table);
}
}
@@ -129,6 +129,7 @@ public function all() {
if (in_array($table, $this->skipTables)) {
continue;
}
TableRegistry::clear();
$this->main($table);
}
}

0 comments on commit 97e1e1b

Please sign in to comment.
You can’t perform that action at this time.