Skip to content

Commit

Permalink
Fix duplicate container added with default values
Browse files Browse the repository at this point in the history
Fix InvalidArgumentException - container already created by default data
  • Loading branch information
juradee committed Jan 11, 2019
1 parent 5884d6a commit b9fa4e1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,12 @@ protected function createDefault()
}

if (!$this->getForm()->isSubmitted()) {
foreach (range(0, $this->createDefault - 1) as $key) {
$this->createOne($key);
$i = 0;
while (iterator_count($this->getContainers()) < $this->createDefault) {
if (!isset($this->created[$i])) {
$this->createOne($i);
}
$i++;
}

} elseif ($this->forceDefault) {
Expand Down

0 comments on commit b9fa4e1

Please sign in to comment.