Symfony\Component\Form\Form::add PHP Method

add() public method

Adds a child to the form.
public add ( Symfony\Component\Form\FormInterface $child ) : Form
$child Symfony\Component\Form\FormInterface 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;
    }

Usage Example

 protected function addField(Form $form, $municipio)
 {
     $formOptions = array('class' => 'SiSuCuentaBundle:Parroquia', 'empty_value' => '-- Seleccionar --', 'attr' => array('class' => 'usuario_parroquia'), 'required' => true, 'label' => 'Parroquia', 'query_builder' => function (EntityRepository $er) use($municipio) {
         return $er->createQueryBuilder('parroquia')->where('parroquia.municipio = :municipio')->setParameter('municipio', $municipio);
     });
     $form->add('parroquia', 'entity', $formOptions);
 }
All Usage Examples Of Symfony\Component\Form\Form::add