diff --git a/src/Container.php b/src/Container.php index 6b2dfda..333011a 100644 --- a/src/Container.php +++ b/src/Container.php @@ -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) {