feature #1309 add a namedForm() method in FormTrait (quazardous)
This PR was squashed before being merged into the 2.0.x-dev branch (closes #1309). Discussion ---------- add a namedForm() method in FormTrait I do prefer using the namedForm builder. Just add the `$this['form.factory']->createNamedBuilder(...)` in `Silex\Application\FormTrait`: ```php /** * Creates and returns a named form builder instance. * * @param string $name * @param mixed $data The initial data for the form * @param array $options Options for the form * @param string|FormTypeInterface $type Type of the form * * @return \Symfony\Component\Form\FormBuilder */ public function namedForm($name, $data = null, array $options = array(), $type = null) { if (null === $type) { // BC with Symfony < 2.8 $type = class_exists('Symfony\Component\Form\Extension\Core\Type\RangeType') ? 'Symfony\Component\Form\Extension\Core\Type\FormType' : 'form'; } return $this['form.factory']->createNamedBuilder($name, $type, $data, $options); } ``` Commits ------- c8e61fc2 add a namedForm() method in FormTrait
Showing
Please register or sign in to comment