Skip to content

Commit 11fa2ef

Browse files
committed
shorten dynamic forms article, don't explain what is already elsewhere in the book or cookbook
1 parent cc55aa3 commit 11fa2ef

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cookbook/form/dynamic_form_generation.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ of what a bare form class looks like::
1111
namespace Acme\DemoBundle\Form\Type;
1212

1313
use Symfony\Component\Form\AbstractType;
14-
use Symfony\Component\Form\FormBuilder;
14+
use Symfony\Component\Form\FormBuilderInterface;
1515

1616
class ProductType extends AbstractType
1717
{
18-
public function buildForm(FormBuilder $builder, array $options)
18+
public function buildForm(FormBuilderInterface $builder, array $options)
1919
{
2020
$builder->add('name');
2121
$builder->add('price');
@@ -56,13 +56,13 @@ to an Event Subscriber::
5656
// src/Acme/DemoBundle/Form/Type/ProductType.php
5757
namespace Acme\DemoBundle\Form\Type;
5858

59-
use Symfony\Component\Form\AbstractType;
60-
use Symfony\Component\Form\FormBuilder;
59+
use Symfony\Component\Form\AbstractType
60+
use Symfony\Component\Form\FormBuilderInterface;
6161
use Acme\DemoBundle\Form\EventListener\AddNameFieldSubscriber;
6262

6363
class ProductType extends AbstractType
6464
{
65-
public function buildForm(FormBuilder $builder, array $options)
65+
public function buildForm(FormBuilderInterface $builder, array $options)
6666
{
6767
$subscriber = new AddNameFieldSubscriber($builder->getFormFactory());
6868
$builder->addEventSubscriber($subscriber);
@@ -128,7 +128,7 @@ might look like the following::
128128

129129
// check if the product object is "new"
130130
if (!$data->getId()) {
131-
$form->add($this->factory->createNamed('text', 'name'));
131+
$form->add($this->factory->createNamed('name', 'text'));
132132
}
133133
}
134134
}

0 commit comments

Comments
 (0)