Skip to content

Commit

Permalink
remove default limit of records when generating a seed file
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Scherer committed Oct 8, 2015
1 parent 4b208a9 commit a7e0dfd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Shell/SchemaShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function getOptionParser()
'default' => false
])->addOption('count', [
'help' => 'Set the limit when generating seed',
'default' => 10
'default' => false
]);
}
}
7 changes: 5 additions & 2 deletions src/Shell/Task/SeedGenerateTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,18 @@ public function templateData()
*/
protected function _getRecordsFromTable($modelName, $useTable = null)
{
$recordCount = (isset($this->params['count']) ? $this->params['count'] : 10);
$recordCount = (isset($this->params['count']) ? $this->params['count'] : false);
$conditions = (isset($this->params['conditions']) ? $this->params['conditions'] : '1=1');
$model = $this->findModel($modelName, $useTable);

$records = $model->find('all')
->where($conditions)
->limit($recordCount)
->hydrate(false);

if ($recordCount) {
$records->limit($recordCount);
}

return $records;
}

Expand Down

0 comments on commit a7e0dfd

Please sign in to comment.