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:
parent
a900ed3f85
commit
a6589c64c3
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user