Skip to content

Migrating Form topics to Symfony Flex structure #8581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions form/action_method.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ form, you can use ``setAction()`` and ``setMethod()``:

.. code-block:: php-symfony

// AppBundle/Controller/DefaultController.php
// src/Controller/DefaultController.php
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
Expand Down Expand Up @@ -75,11 +75,11 @@ options:

.. code-block:: php-symfony

// AppBundle/Controller/DefaultController.php
// src/Controller/DefaultController.php
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use App\Form\TaskType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
Expand All @@ -98,8 +98,8 @@ options:

.. code-block:: php-standalone

use Symfony\Component\Form\Forms;
use App\Form\TaskType;
use Symfony\Component\Form\Forms;

$formFactoryBuilder = Forms::createFormFactoryBuilder();

Expand Down
14 changes: 7 additions & 7 deletions form/create_custom_field_type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ the class name of your type. For more information, see :ref:`form-customization-

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

.. code-block:: yaml

# app/config/config.yml
# config/packages/twig.yaml
twig:
form_themes:
- 'form/fields.html.twig'

.. code-block:: xml

<!-- app/config/config.xml -->
<!-- config/packages/twig.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -193,7 +193,7 @@ link for details), create a ``shipping_widget`` block to handle this:

.. code-block:: php

// app/config/config.php
// config/packages/twig.php
$container->loadFromExtension('twig', array(
'form_themes' => array(
'form/fields.html.twig',
Expand All @@ -206,7 +206,7 @@ link for details), create a ``shipping_widget`` block to handle this:

.. code-block:: yaml

# app/config/config.yml
# config/packages/framework.yaml
framework:
templating:
form:
Expand All @@ -215,7 +215,7 @@ link for details), create a ``shipping_widget`` block to handle this:

.. code-block:: xml

<!-- app/config/config.xml -->
<!-- config/packages/framework.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -234,7 +234,7 @@ link for details), create a ``shipping_widget`` block to handle this:

.. code-block:: php

// app/config/config.php
// config/packages/framework.php
$container->loadFromExtension('framework', array(
'templating' => array(
'form' => array(
Expand Down
12 changes: 6 additions & 6 deletions form/dynamic_form_modification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ sport like this::
{
$builder
->add('sport', EntityType::class, array(
'class' => 'AppBundle:Sport',
'class' => 'App:Sport',
'placeholder' => '',
))
;
Expand All @@ -409,7 +409,7 @@ sport like this::
$positions = null === $sport ? array() : $sport->getAvailablePositions();

$form->add('position', EntityType::class, array(
'class' => 'AppBundle:Position',
'class' => 'App:Position',
'placeholder' => '',
'choices' => $positions,
));
Expand Down Expand Up @@ -445,18 +445,18 @@ The type would now look like::
// src/Form/Type/SportMeetupType.php
namespace App\Form\Type;

// ...
use App\Entity\Sport;
use Symfony\Component\Form\FormInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use App\Entity\Sport;
// ...

class SportMeetupType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('sport', EntityType::class, array(
'class' => 'AppBundle:Sport',
'class' => 'App:Sport',
'placeholder' => '',
));
;
Expand All @@ -465,7 +465,7 @@ The type would now look like::
$positions = null === $sport ? array() : $sport->getAvailablePositions();

$form->add('position', EntityType::class, array(
'class' => 'AppBundle:Position',
'class' => 'App:Position',
'placeholder' => '',
'choices' => $positions,
));
Expand Down
2 changes: 1 addition & 1 deletion form/form_collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ you will learn about next!).
Doctrine:

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

To fix this, you may choose to "cascade" the persist operation automatically
Expand Down
32 changes: 16 additions & 16 deletions form/form_customization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -483,15 +483,15 @@ rendered.

.. code-block:: yaml

# app/config/config.yml
# config/packages/twig.yaml
twig:
form_themes:
- 'form/fields.html.twig'
# ...

.. code-block:: xml

<!-- app/config/config.xml -->
<!-- config/packages/twig.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -509,7 +509,7 @@ rendered.

.. code-block:: php

// app/config/config.php
// config/packages/twig.php
$container->loadFromExtension('twig', array(
'form_themes' => array(
'form/fields.html.twig',
Expand All @@ -526,15 +526,15 @@ resource to use such a layout:

.. code-block:: yaml

# app/config/config.yml
# config/packages/twig.yaml
twig:
form_themes:
- 'form_table_layout.html.twig'
# ...

.. code-block:: xml

<!-- app/config/config.xml -->
<!-- config/packages/twig.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -552,7 +552,7 @@ resource to use such a layout:

.. code-block:: php

// app/config/config.php
// config/packages/twig.php
$container->loadFromExtension('twig', array(
'form_themes' => array(
'form_table_layout.html.twig',
Expand All @@ -575,24 +575,24 @@ PHP
~~~

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

.. configuration-block::

.. code-block:: yaml

# app/config/config.yml
# config/packages/framework.yaml
framework:
templating:
form:
resources:
- 'AppBundle:Form'
- 'App:Form'
# ...

.. code-block:: xml

<!-- app/config/config.xml -->
<!-- config/packages/framework.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -605,7 +605,7 @@ form is rendered.
<framework:config>
<framework:templating>
<framework:form>
<framework:resource>AppBundle:Form</framework:resource>
<framework:resource>App:Form</framework:resource>
</framework:form>
</framework:templating>
<!-- ... -->
Expand All @@ -614,13 +614,13 @@ form is rendered.

.. code-block:: php

// app/config/config.php
// config/packages/framework.php
// PHP
$container->loadFromExtension('framework', array(
'templating' => array(
'form' => array(
'resources' => array(
'AppBundle:Form',
'App:Form',
),
),
),
Expand All @@ -636,7 +636,7 @@ resource to use such a layout:

.. code-block:: yaml

# app/config/config.yml
# config/packages/framework.yaml
framework:
templating:
form:
Expand All @@ -645,7 +645,7 @@ resource to use such a layout:

.. code-block:: xml

<!-- app/config/config.xml -->
<!-- config/packages/framework.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -667,7 +667,7 @@ resource to use such a layout:

.. code-block:: php

// app/config/config.php
// config/packages/framework.php
$container->loadFromExtension('framework', array(
'templating' => array(
'form' => array(
Expand Down
12 changes: 6 additions & 6 deletions form/form_themes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,15 @@ file:

.. code-block:: yaml

# app/config/config.yml
# config/packages/twig.yaml
twig:
form_themes:
- 'form/fields.html.twig'
# ...

.. code-block:: xml

<!-- app/config/config.xml -->
<!-- config/packages/twig.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -224,7 +224,7 @@ file:

.. code-block:: php

// app/config/config.php
// config/packages/twig.php
$container->loadFromExtension('twig', array(
'form_themes' => array(
'form/fields.html.twig',
Expand Down Expand Up @@ -280,7 +280,7 @@ file:

.. code-block:: yaml

# app/config/config.yml
# config/packages/framework.yaml
framework:
templating:
form:
Expand All @@ -290,7 +290,7 @@ file:

.. code-block:: xml

<!-- app/config/config.xml -->
<!-- config/packages/framework.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -311,7 +311,7 @@ file:

.. code-block:: php

// app/config/config.php
// config/packages/framework.php
$container->loadFromExtension('framework', array(
'templating' => array(
'form' => array(
Expand Down