Skip to content

Commit 372774a

Browse files
committed
Migrate Form topics to Symfony Flex structure
1 parent a255be4 commit 372774a

File tree

6 files changed

+40
-40
lines changed

6 files changed

+40
-40
lines changed

form/action_method.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ form, you can use ``setAction()`` and ``setMethod()``:
1515

1616
.. code-block:: php-symfony
1717
18-
// AppBundle/Controller/DefaultController.php
18+
// src/Controller/DefaultController.php
1919
namespace App\Controller;
2020
2121
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
@@ -75,11 +75,11 @@ options:
7575

7676
.. code-block:: php-symfony
7777
78-
// AppBundle/Controller/DefaultController.php
78+
// src/Controller/DefaultController.php
7979
namespace App\Controller;
8080
81-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8281
use App\Form\TaskType;
82+
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8383
8484
class DefaultController extends Controller
8585
{
@@ -98,8 +98,8 @@ options:
9898
9999
.. code-block:: php-standalone
100100
101-
use Symfony\Component\Form\Forms;
102101
use App\Form\TaskType;
102+
use Symfony\Component\Form\Forms;
103103
104104
$formFactoryBuilder = Forms::createFormFactoryBuilder();
105105

form/create_custom_field_type.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ the class name of your type. For more information, see :ref:`form-customization-
104104

105105
When the name of your form class matches any of the built-in field types,
106106
your form might not be rendered correctly. A form type named
107-
``AppBundle\Form\PasswordType`` will have the same block name as the
107+
``App\Form\PasswordType`` will have the same block name as the
108108
built-in ``PasswordType`` and won't be rendered correctly. Override the
109109
``getBlockPrefix()`` method to return a unique block prefix (e.g.
110110
``app_password``) to avoid collisions.
@@ -169,14 +169,14 @@ link for details), create a ``shipping_widget`` block to handle this:
169169

170170
.. code-block:: yaml
171171
172-
# app/config/config.yml
172+
# config/packages/twig.yaml
173173
twig:
174174
form_themes:
175175
- 'form/fields.html.twig'
176176
177177
.. code-block:: xml
178178
179-
<!-- app/config/config.xml -->
179+
<!-- config/packages/twig.xml -->
180180
<?xml version="1.0" encoding="UTF-8" ?>
181181
<container xmlns="http://symfony.com/schema/dic/services"
182182
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -193,7 +193,7 @@ link for details), create a ``shipping_widget`` block to handle this:
193193
194194
.. code-block:: php
195195
196-
// app/config/config.php
196+
// config/packages/twig.php
197197
$container->loadFromExtension('twig', array(
198198
'form_themes' => array(
199199
'form/fields.html.twig',
@@ -206,7 +206,7 @@ link for details), create a ``shipping_widget`` block to handle this:
206206

207207
.. code-block:: yaml
208208
209-
# app/config/config.yml
209+
# config/packages/framework.yaml
210210
framework:
211211
templating:
212212
form:
@@ -215,7 +215,7 @@ link for details), create a ``shipping_widget`` block to handle this:
215215
216216
.. code-block:: xml
217217
218-
<!-- app/config/config.xml -->
218+
<!-- config/packages/framework.xml -->
219219
<?xml version="1.0" encoding="UTF-8" ?>
220220
<container xmlns="http://symfony.com/schema/dic/services"
221221
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -234,7 +234,7 @@ link for details), create a ``shipping_widget`` block to handle this:
234234
235235
.. code-block:: php
236236
237-
// app/config/config.php
237+
// config/packages/framework.php
238238
$container->loadFromExtension('framework', array(
239239
'templating' => array(
240240
'form' => array(

form/dynamic_form_modification.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ sport like this::
392392
{
393393
$builder
394394
->add('sport', EntityType::class, array(
395-
'class' => 'AppBundle:Sport',
395+
'class' => 'App:Sport',
396396
'placeholder' => '',
397397
))
398398
;
@@ -409,7 +409,7 @@ sport like this::
409409
$positions = null === $sport ? array() : $sport->getAvailablePositions();
410410

411411
$form->add('position', EntityType::class, array(
412-
'class' => 'AppBundle:Position',
412+
'class' => 'App:Position',
413413
'placeholder' => '',
414414
'choices' => $positions,
415415
));
@@ -445,18 +445,18 @@ The type would now look like::
445445
// src/Form/Type/SportMeetupType.php
446446
namespace App\Form\Type;
447447

448-
// ...
448+
use App\Entity\Sport;
449449
use Symfony\Component\Form\FormInterface;
450450
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
451-
use App\Entity\Sport;
451+
// ...
452452

453453
class SportMeetupType extends AbstractType
454454
{
455455
public function buildForm(FormBuilderInterface $builder, array $options)
456456
{
457457
$builder
458458
->add('sport', EntityType::class, array(
459-
'class' => 'AppBundle:Sport',
459+
'class' => 'App:Sport',
460460
'placeholder' => '',
461461
));
462462
;
@@ -465,7 +465,7 @@ The type would now look like::
465465
$positions = null === $sport ? array() : $sport->getAvailablePositions();
466466

467467
$form->add('position', EntityType::class, array(
468-
'class' => 'AppBundle:Position',
468+
'class' => 'App:Position',
469469
'placeholder' => '',
470470
'choices' => $positions,
471471
));

form/form_collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ you will learn about next!).
488488
Doctrine:
489489

490490
A new entity was found through the relationship
491-
``AppBundle\Entity\Task#tags`` that was not configured to
491+
``App\Entity\Task#tags`` that was not configured to
492492
cascade persist operations for entity...
493493

494494
To fix this, you may choose to "cascade" the persist operation automatically

form/form_customization.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -483,15 +483,15 @@ rendered.
483483

484484
.. code-block:: yaml
485485
486-
# app/config/config.yml
486+
# config/packages/twig.yaml
487487
twig:
488488
form_themes:
489489
- 'form/fields.html.twig'
490490
# ...
491491
492492
.. code-block:: xml
493493
494-
<!-- app/config/config.xml -->
494+
<!-- config/packages/twig.xml -->
495495
<?xml version="1.0" encoding="UTF-8" ?>
496496
<container xmlns="http://symfony.com/schema/dic/services"
497497
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -509,7 +509,7 @@ rendered.
509509
510510
.. code-block:: php
511511
512-
// app/config/config.php
512+
// config/packages/twig.php
513513
$container->loadFromExtension('twig', array(
514514
'form_themes' => array(
515515
'form/fields.html.twig',
@@ -526,15 +526,15 @@ resource to use such a layout:
526526

527527
.. code-block:: yaml
528528
529-
# app/config/config.yml
529+
# config/packages/twig.yaml
530530
twig:
531531
form_themes:
532532
- 'form_table_layout.html.twig'
533533
# ...
534534
535535
.. code-block:: xml
536536
537-
<!-- app/config/config.xml -->
537+
<!-- config/packages/twig.xml -->
538538
<?xml version="1.0" encoding="UTF-8" ?>
539539
<container xmlns="http://symfony.com/schema/dic/services"
540540
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -552,7 +552,7 @@ resource to use such a layout:
552552
553553
.. code-block:: php
554554
555-
// app/config/config.php
555+
// config/packages/twig.php
556556
$container->loadFromExtension('twig', array(
557557
'form_themes' => array(
558558
'form_table_layout.html.twig',
@@ -575,24 +575,24 @@ PHP
575575
~~~
576576

577577
By using the following configuration, any customized form fragments inside the
578-
``templates/Form`` folder will be used globally when a
578+
``templates/form`` folder will be used globally when a
579579
form is rendered.
580580

581581
.. configuration-block::
582582

583583
.. code-block:: yaml
584584
585-
# app/config/config.yml
585+
# config/packages/framework.yaml
586586
framework:
587587
templating:
588588
form:
589589
resources:
590-
- 'AppBundle:Form'
590+
- 'App:Form'
591591
# ...
592592
593593
.. code-block:: xml
594594
595-
<!-- app/config/config.xml -->
595+
<!-- config/packages/framework.xml -->
596596
<?xml version="1.0" encoding="UTF-8" ?>
597597
<container xmlns="http://symfony.com/schema/dic/services"
598598
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -605,7 +605,7 @@ form is rendered.
605605
<framework:config>
606606
<framework:templating>
607607
<framework:form>
608-
<framework:resource>AppBundle:Form</framework:resource>
608+
<framework:resource>App:Form</framework:resource>
609609
</framework:form>
610610
</framework:templating>
611611
<!-- ... -->
@@ -614,13 +614,13 @@ form is rendered.
614614
615615
.. code-block:: php
616616
617-
// app/config/config.php
617+
// config/packages/framework.php
618618
// PHP
619619
$container->loadFromExtension('framework', array(
620620
'templating' => array(
621621
'form' => array(
622622
'resources' => array(
623-
'AppBundle:Form',
623+
'App:Form',
624624
),
625625
),
626626
),
@@ -636,7 +636,7 @@ resource to use such a layout:
636636

637637
.. code-block:: yaml
638638
639-
# app/config/config.yml
639+
# config/packages/framework.yaml
640640
framework:
641641
templating:
642642
form:
@@ -645,7 +645,7 @@ resource to use such a layout:
645645
646646
.. code-block:: xml
647647
648-
<!-- app/config/config.xml -->
648+
<!-- config/packages/framework.xml -->
649649
<?xml version="1.0" encoding="UTF-8" ?>
650650
<container xmlns="http://symfony.com/schema/dic/services"
651651
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -667,7 +667,7 @@ resource to use such a layout:
667667
668668
.. code-block:: php
669669
670-
// app/config/config.php
670+
// config/packages/framework.php
671671
$container->loadFromExtension('framework', array(
672672
'templating' => array(
673673
'form' => array(

form/form_themes.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,15 @@ file:
199199

200200
.. code-block:: yaml
201201
202-
# app/config/config.yml
202+
# config/packages/twig.yaml
203203
twig:
204204
form_themes:
205205
- 'form/fields.html.twig'
206206
# ...
207207
208208
.. code-block:: xml
209209
210-
<!-- app/config/config.xml -->
210+
<!-- config/packages/twig.xml -->
211211
<?xml version="1.0" encoding="UTF-8" ?>
212212
<container xmlns="http://symfony.com/schema/dic/services"
213213
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -224,7 +224,7 @@ file:
224224
225225
.. code-block:: php
226226
227-
// app/config/config.php
227+
// config/packages/twig.php
228228
$container->loadFromExtension('twig', array(
229229
'form_themes' => array(
230230
'form/fields.html.twig',
@@ -280,7 +280,7 @@ file:
280280

281281
.. code-block:: yaml
282282
283-
# app/config/config.yml
283+
# config/packages/framework.yaml
284284
framework:
285285
templating:
286286
form:
@@ -290,7 +290,7 @@ file:
290290
291291
.. code-block:: xml
292292
293-
<!-- app/config/config.xml -->
293+
<!-- config/packages/framework.xml -->
294294
<?xml version="1.0" encoding="UTF-8" ?>
295295
<container xmlns="http://symfony.com/schema/dic/services"
296296
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -311,7 +311,7 @@ file:
311311
312312
.. code-block:: php
313313
314-
// app/config/config.php
314+
// config/packages/framework.php
315315
$container->loadFromExtension('framework', array(
316316
'templating' => array(
317317
'form' => array(

0 commit comments

Comments
 (0)