1
0
mirror of https://github.com/fzaninotto/Faker.git synced 2025-03-22 00:09:59 +01:00

Fix sortable entity populator modifier

This commit is contained in:
Francois Zaninotto 2012-04-27 23:53:52 +02:00
parent a900ed3f85
commit a6589c64c3

View File

@ -132,8 +132,8 @@ class EntityPopulator
break;
case 'sortable':
$modifiers['sortable'] = function($obj, $inserted) use ($class, $generator) {
$nbInserted = count($inserted[$class]);
$obj->insertAtRank(mt_rand(1, $nbInserted ? $nbInserted : 1));
$maxRank = isset($inserted[$class]) ? count($inserted[$class]) : 0;
$obj->insertAtRank(mt_rand(1, $maxRank + 1));
};
break;
}