extractConfiguration() public method

public extractConfiguration ( Symfony\Component\Form\FormInterface $form )
$form Symfony\Component\Form\FormInterface
Exemplo n.º 1
0
 public function testExtractConfigurationBuildsIdRecursively()
 {
     $type = $this->getMock('Symfony\\Component\\Form\\ResolvedFormTypeInterface');
     $type->expects($this->any())->method('getInnerType')->will($this->returnValue(new \stdClass()));
     $grandParent = $this->createBuilder('grandParent')->setCompound(true)->setDataMapper($this->getMock('Symfony\\Component\\Form\\DataMapperInterface'))->getForm();
     $parent = $this->createBuilder('parent')->setCompound(true)->setDataMapper($this->getMock('Symfony\\Component\\Form\\DataMapperInterface'))->getForm();
     $form = $this->createBuilder('name')->setType($type)->getForm();
     $grandParent->add($parent);
     $parent->add($form);
     $this->assertSame(array('id' => 'grandParent_parent_name', 'name' => 'name', 'type_class' => 'stdClass', 'synchronized' => true, 'passed_options' => array(), 'resolved_options' => array()), $this->dataExtractor->extractConfiguration($form));
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function collectConfiguration(FormInterface $form)
 {
     $hash = spl_object_hash($form);
     if (!isset($this->dataByForm[$hash])) {
         $this->dataByForm[$hash] = array();
     }
     $this->dataByForm[$hash] = array_replace($this->dataByForm[$hash], $this->dataExtractor->extractConfiguration($form));
     foreach ($form as $child) {
         $this->collectConfiguration($child);
     }
 }