setParent() public method

Sets the parent form.
public setParent ( Symfony\Component\Form\FormInterface $parent = null ) : Form
$parent Symfony\Component\Form\FormInterface The parent form
return Form The current form
 /**
  * @param string $name
  * @param string $dataClass
  * @param array $options
  * @param FormInterface $parent
  * @return FormInterface
  */
 protected function createForm($name, $dataClass = null, array $options = array(), FormInterface $parent = null)
 {
     $eventDispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $config = new FormConfigBuilder($name, $dataClass, $eventDispatcher, $options);
     $result = new Form($config);
     $result->setParent($parent);
     return $result;
 }
Example #2
0
 public function testMultipartFormsWithParentsRequireNoFiles()
 {
     $form = new Form('author', new Author(), $this->validator);
     $form->add($this->createMultipartMockField('file'));
     $form->setParent($this->createMockField('group'));
     // files are expected to be converted by the parent
     $form->bind(array('file' => 'test.txt'));
 }