diff --git a/src/Kdyby/Replicator/Container.php b/src/Kdyby/Replicator/Container.php index 93ab02e..dca11db 100644 --- a/src/Kdyby/Replicator/Container.php +++ b/src/Kdyby/Replicator/Container.php @@ -275,8 +275,8 @@ protected function createDefault() } if (!$this->getForm()->isSubmitted()) { - foreach (range(0, $this->createDefault - 1) as $key) { - $this->createOne($key); + while (iterator_count($this->getContainers()) < $this->createDefault) { + $this->createOne(); } } elseif ($this->forceDefault) {