/** * Adds a child to the form. * * @param FormInterface $child The FormInterface to add as a child * * @return Form the current form */ public function add(FormInterface $child) { $this->children[$child->getName()] = $child; $child->setParent($this); if ($this->dataMapper) { $this->dataMapper->mapDataToForm($this->getClientData(), $child); } return $this; }
/** * Adds a child to the form. * * @param FormInterface $child The FormInterface to add as a child * * @return Form the current form */ public function add(FormInterface $child) { if ($this->bound) { throw new AlreadyBoundException('You cannot add children to a bound form'); } $this->children[$child->getName()] = $child; $child->setParent($this); if ($this->dataMapper) { $this->dataMapper->mapDataToForm($this->getClientData(), $child); } return $this; }