Skip to content

Commit

Permalink
Merge pull request #3 from webwingscz/1-default-values-and-createdefa…
Browse files Browse the repository at this point in the history
…ult-error

Fix duplicate container added with default values
  • Loading branch information
juradee authored Jan 11, 2019
2 parents 5884d6a + b9fa4e1 commit 8f2008e
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 8f2008e

Please sign in to comment.