Skip to content

Commit

Permalink
used only unkipped models in bake all --everything
Browse files Browse the repository at this point in the history
jus a small refactoring to avoid maintaining the list of table to be skipped in two places.
  • Loading branch information
antograssiot committed Aug 20, 2015
1 parent 05e75b5 commit 0fce343
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Shell/BakeShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function all($name = null)
if (empty($name) && !$this->param('everything')) {
$this->Model->connection = $this->connection;
$this->out('Possible model names based on your database:');
foreach ($this->Model->listAll() as $table) {
foreach ($this->Model->listUnskipped() as $table) {
$this->out('- ' . $table);
}
$this->out('Run <info>`cake bake all [name]`</info> to generate skeleton files.');
Expand All @@ -237,11 +237,7 @@ public function all($name = null)

if ($this->param('everything')) {
$this->Model->connection = $this->connection;
$allTables = collection($this->Model->listAll());
$filteredTables = $allTables->reject(function ($tableName) {
$ignoredTables = ['i18n', 'cake_sessions', 'phinxlog', 'users_phinxlog'];
return in_array($tableName, $ignoredTables);
});
$filteredTables = collection($this->Model->listUnskipped());
}

$filteredTables->each(function ($tableName) {
Expand Down

0 comments on commit 0fce343

Please sign in to comment.