diff --git a/src/Kdyby/Replicator/Container.php b/src/Kdyby/Replicator/Container.php index 687d5ce..ada2a5a 100644 --- a/src/Kdyby/Replicator/Container.php +++ b/src/Kdyby/Replicator/Container.php @@ -44,9 +44,6 @@ class Container extends Nette\Forms\Container /** @var array */ private $created = array(); - /** @var \Nette\Http\IRequest */ - private $httpRequest; - /** @var array */ private $httpPost; @@ -162,11 +159,9 @@ private function getFirstControlName() /** - * @param string $name - * * @return \Nette\Forms\Container */ - protected function createContainer($name) + protected function createContainer() { $class = $this->containerClass; return new $class(); @@ -209,7 +204,7 @@ public function createOne($name = NULL) $name = $names ? max($names) + 1 : 0; } - // Container is overriden, therefore every request for getComponent($name, FALSE) would return container + // Container is overridden, therefore every request for getComponent($name, FALSE) would return container if (isset($this->created[$name])) { throw new Nette\InvalidArgumentException("Container with name '$name' already exists."); } @@ -227,11 +222,9 @@ public function createOne($name = NULL) */ public function setValues($values, $erase = FALSE, $onlyDisabled = FALSE) { - if (!$this->form->isAnchored() || !$this->form->isSubmitted()) { - foreach ($values as $name => $value) { - if ((is_array($value) || $value instanceof \Traversable) && !$this->getComponent($name, FALSE)) { - $this->createOne($name); - } + foreach ($values as $name => $value) { + if ((is_array($value) || $value instanceof \Traversable) && !$this->getComponent($name, FALSE)) { + $this->createOne($name); } } @@ -250,11 +243,7 @@ protected function loadHttpData() return; } - foreach ((array) $this->getHttpData() as $name => $value) { - if ((is_array($value) || $value instanceof \Traversable) && !$this->getComponent($name, FALSE)) { - $this->createOne($name); - } - } + $this->setValues((array) $this->getHttpData()); } @@ -310,33 +299,6 @@ private function getHttpData() - /** - * @internal - * @param \Nette\Application\Request $request - * @return Container - */ - public function setRequest(Nette\Application\Request $request) - { - $this->httpRequest = $request; - return $this; - } - - - - /** - * @return \Nette\Application\Request - */ - private function getRequest() - { - if ($this->httpRequest !== NULL) { - return $this->httpRequest; - } - - return $this->httpRequest = $this->getForm()->getPresenter()->getRequest(); - } - - - /** * @param \Nette\Forms\Container $container * @param boolean $cleanUpGroups