Bladeren bron

updated for the latest version of Symfony

Fabien Potencier 14 jaren geleden
bovenliggende
commit
0278b948c0
5 gewijzigde bestanden met toevoegingen van 7 en 22 verwijderingen
  1. 1 2
      Controller/ConfiguratorController.php
  2. 1 8
      Form/CsrfType.php
  3. 1 8
      Form/DoctrineType.php
  4. 2 2
      Step/CsrfStep.php
  5. 2 2
      Step/DoctrineStep.php

+ 1 - 2
Controller/ConfiguratorController.php

@@ -30,8 +30,7 @@ class ConfiguratorController extends ContainerAware
         $configurator = $this->container->get('symfony.webconfigurator');
 
         $step = $configurator->getStep($index);
-        $form = $this->container->get('form.factory')->create($step->getFormType());
-        $form->setData($step);
+        $form = $this->container->get('form.factory')->create($step->getFormType(), $step);
 
         $request = $this->container->get('request');
         if ('POST' === $request->getMethod()) {

+ 1 - 8
Form/CsrfType.php

@@ -19,17 +19,10 @@ use Symfony\Component\Form\FormBuilder;
  *
  * @author Marc Weistroff <marc.weistroff@sensio.com>
  */
-class CsrfType extends AbstractType
+class CsrfStepType extends AbstractType
 {
     public function buildForm(FormBuilder $builder, array $options)
     {
         $builder->add('csrf_secret', 'text');
     }
-
-    public function getDefaultOptions(array $options)
-    {
-        return array(
-            'data_class' => 'Symfony\Bundle\WebConfiguratorBundle\Step\CsrfStep',
-        );
-    }
 }

+ 1 - 8
Form/DoctrineType.php

@@ -20,7 +20,7 @@ use Symfony\Component\Form\FormBuilder;
  *
  * @author Fabien Potencier <fabien@symfony.com>
  */
-class DoctrineType extends AbstractType
+class DoctrineStepType extends AbstractType
 {
     public function buildForm(FormBuilder $builder, array $options)
     {
@@ -37,11 +37,4 @@ class DoctrineType extends AbstractType
             ))
         ;
     }
-
-    public function getDefaultOptions(array $options)
-    {
-        return array(
-            'data_class' => 'Symfony\Bundle\WebConfiguratorBundle\Step\DoctrineStep',
-        );
-    }
 }

+ 2 - 2
Step/CsrfStep.php

@@ -12,7 +12,7 @@
 namespace Symfony\Bundle\WebConfiguratorBundle\Step;
 
 use Symfony\Bundle\WebConfiguratorBundle\Exception\StepRequirementException;
-use Symfony\Bundle\WebConfiguratorBundle\Form\CsrfType;
+use Symfony\Bundle\WebConfiguratorBundle\Form\CsrfStepType;
 
 /**
  * Csrf Step.
@@ -36,7 +36,7 @@ class CsrfStep implements StepInterface
      */
     public function getFormType()
     {
-        return new CsrfType();
+        return new CsrfStepType();
     }
 
     /**

+ 2 - 2
Step/DoctrineStep.php

@@ -12,7 +12,7 @@
 namespace Symfony\Bundle\WebConfiguratorBundle\Step;
 
 use Symfony\Bundle\WebConfiguratorBundle\Exception\StepRequirementException;
-use Symfony\Bundle\WebConfiguratorBundle\Form\DoctrineType;
+use Symfony\Bundle\WebConfiguratorBundle\Form\DoctrineStepType;
 
 /**
  * Doctrine Step.
@@ -59,7 +59,7 @@ class DoctrineStep implements StepInterface
      */
     public function getFormType()
     {
-        return new DoctrineType();
+        return new DoctrineStepType();
     }
 
     /**