Author: Bernhard Schussek (bschussek@gmail.com)
Inheritance: implements Symfony\Component\Form\Extension\DataCollector\FormDataExtractorInterface
Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function collectViewVariables(FormView $view)
 {
     $hash = spl_object_hash($view);
     if (!isset($this->dataByView[$hash])) {
         $this->dataByView[$hash] = array();
     }
     $this->dataByView[$hash] = array_replace($this->dataByView[$hash], $this->dataExtractor->extractViewVariables($view));
     foreach ($view->children as $child) {
         $this->collectViewVariables($child);
     }
 }
Esempio n. 2
0
    public function testExtractViewVariables()
    {
        $view = new FormView();

        $view->vars = array(
            'b' => 'foo',
            'a' => 'bar',
            'c' => 'baz',
            'id' => 'foo_bar',
            'name' => 'bar',
        );

        $this->assertSame(array(
            'id' => 'foo_bar',
            'name' => 'bar',
            'view_vars' => array(
                'a' => 'bar',
                'b' => 'foo',
                'c' => 'baz',
                'id' => 'foo_bar',
                'name' => 'bar',
            ),
        ), $this->dataExtractor->extractViewVariables($view));
    }