-
-Now that you've created the customized form template, you need to tell Symfony
-to use it. Inside the template where you're actually rendering your form,
-tell Symfony to use the theme via the ``setTheme()`` helper method::
-
- setTheme($form, [':form']) ?>
-
- widget($form['age']) ?>
-
-When the ``form.age`` widget is rendered, Symfony will use the customized
-``integer_widget.html.php`` template and the ``input`` tag will be wrapped in
-the ``div`` element.
-
-If you want to apply a theme to a specific child form, pass it to the ``setTheme()``
-method::
-
- setTheme($form['child'], ':form') ?>
-
-.. note::
-
- The ``:form`` syntax is based on the functional names for templates:
- ``Bundle:Directory``. As the form directory lives in the
- ``templates/`` directory, the ``Bundle`` part is empty, resulting
- in ``:form``.
-
-Making Application-wide Customizations
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-If you'd like a certain form customization to be global to your application,
-you can accomplish this by making the form customizations in an external
-template and then importing it inside your application configuration.
-
-By using the following configuration, any customized form fragments inside the
-``templates/form`` folder will be used globally when a
-form is rendered.
-
-.. configuration-block::
-
- .. code-block:: yaml
-
- # config/packages/framework.yaml
- framework:
- templating:
- form:
- resources:
- - 'App:Form'
- # ...
-
- .. code-block:: xml
-
-
-
-
-
-
-
-
- App:Form
-
-
-
-
-
-
- .. code-block:: php
-
- // config/packages/framework.php
- // PHP
- $container->loadFromExtension('framework', [
- 'templating' => [
- 'form' => [
- 'resources' => [
- 'App:Form',
- ],
- ],
- ],
-
- // ...
- ]);
-
-By default, the PHP engine uses a *div* layout when rendering forms. Some people,
-however, may prefer to render forms in a *table* layout. Use the ``FrameworkBundle:FormTable``
-resource to use such a layout:
-
-.. configuration-block::
-
- .. code-block:: yaml
-
- # config/packages/framework.yaml
- framework:
- templating:
- form:
- resources:
- - 'FrameworkBundle:FormTable'
-
- .. code-block:: xml
-
-
-
-
-
-
-
-
- FrameworkBundle:FormTable
-
-
-
-
-
-
- .. code-block:: php
-
- // config/packages/framework.php
- $container->loadFromExtension('framework', [
- 'templating' => [
- 'form' => [
- 'resources' => [
- 'FrameworkBundle:FormTable',
- ],
- ],
- ],
-
- // ...
- ]);
-
-If you only want to make the change in one template, add the following line to
-your template file rather than adding the template as a resource:
-
-.. code-block:: html+php
-
- setTheme($form, ['FrameworkBundle:FormTable']) ?>
-
-Note that the ``$form`` variable in the above code is the form view variable
-that you passed to your template.
-
-Adding a "Required" Asterisk to Field Labels
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-If you want to denote all of your required fields with a required asterisk
-(``*``), you can do this by customizing the ``form_label`` fragment.
-
-When using PHP as a templating engine you have to copy the content from the
-original template:
-
-.. code-block:: html+php
-
-
-
-
-
-
- humanize($name); } ?>
-
-
-
-
- *
-
-
-Adding "help" Messages
-~~~~~~~~~~~~~~~~~~~~~~
-
-You can also customize your form widgets to have an optional "help" message.
-
-When using PHP as a templating engine you have to copy the content from the
-original template:
-
-.. code-block:: html+php
-
-
-
-
- value="= $view->escape($value) ?>"
- = $view['form']->block($form, 'widget_attributes') ?>
- />
-
-
-
- = $view->escape($help) ?>
-
+ Starting from Symfony 5.0, PHP templates are no longer supported. Use
+ :doc:`Twig ` instead to create your templates.
diff --git a/templating/hinclude.rst b/templating/hinclude.rst
index def7939ab17..b192ad08b8a 100644
--- a/templating/hinclude.rst
+++ b/templating/hinclude.rst
@@ -67,12 +67,6 @@ default content rendering some template:
],
]);
-.. versionadded:: 4.3
-
- The ``framework.fragments.hinclude_default_template`` option was introduced
- in Symfony 4.3. In previous Symfony versions it was called
- ``framework.templating.hinclude_default_template``.
-
You can define default templates per ``render()`` function (which will override
any global default template that is defined):
diff --git a/testing.rst b/testing.rst
index 4fd211cee26..99fcdd2e3bb 100644
--- a/testing.rst
+++ b/testing.rst
@@ -215,10 +215,6 @@ its existence, attributes, text, etc.
The ``assertSelectorTextContains`` method is not a native PHPUnit assertion and is
available thanks to the ``WebTestCase`` class.
-.. versionadded:: 4.3
-
- The ``WebTestCase`` assertions were introduced in Symfony 4.3
-
.. seealso::
Using native PHPUnit methods, the same assertion would look like this::
@@ -711,10 +707,6 @@ The Crawler can extract information from the nodes::
return $node->attr('href');
});
-.. versionadded:: 4.4
-
- The option to trim white spaces in ``text()`` was introduced in Symfony 4.4.
-
Links
~~~~~
@@ -820,10 +812,6 @@ their type::
:method:`Symfony\\Component\\DomCrawler\\Form::getName` method to get the
form name.
- .. versionadded:: 4.4
-
- The ``getName()`` method was introduced in Symfony 4.4.
-
.. tip::
If you purposefully want to select "invalid" select/radio values, see
diff --git a/testing/database.rst b/testing/database.rst
index 0ecf9149eba..5ed19b4e91f 100644
--- a/testing/database.rst
+++ b/testing/database.rst
@@ -221,7 +221,7 @@ so, get the entity manager via the service container as follows::
*/
private $entityManager;
- protected function setUp()
+ protected function setUp(): void
{
$kernel = self::bootKernel();
@@ -240,7 +240,7 @@ so, get the entity manager via the service container as follows::
$this->assertSame(14.50, $product->getPrice());
}
- protected function tearDown()
+ protected function tearDown(): void
{
parent::tearDown();
diff --git a/testing/functional_tests_assertions.rst b/testing/functional_tests_assertions.rst
index 6cff835e1f0..68c38455741 100644
--- a/testing/functional_tests_assertions.rst
+++ b/testing/functional_tests_assertions.rst
@@ -4,11 +4,6 @@
Functional Test specific Assertions
===================================
-.. versionadded:: 4.3
-
- The shortcut methods for assertions using ``WebTestCase`` were introduced
- in Symfony 4.3.
-
When doing functional tests, sometimes you need to make complex assertions in
order to check whether the ``Request``, the ``Response`` or the ``Crawler``
contain the expected information to make your test succeed.
@@ -32,12 +27,6 @@ Now here is the example with the assertions specific to Symfony::
Assertions Reference
---------------------
-.. versionadded:: 4.4
-
- Starting from Symfony 4.4, when using `symfony/panther`_ for end-to-end
- testing, you can use all the following assertions except the ones related to
- the :doc:`Crawler `.
-
Response
~~~~~~~~
@@ -68,6 +57,11 @@ Browser
Crawler
~~~~~~~
+.. note::
+
+ You cannot use the :doc:`Crawler ` assertions,
+ when using `symfony/panther`_ for end-to-end testing.
+
- ``assertSelectorExists()``
- ``assertSelectorNotExists()``
- ``assertSelectorTextContains()``
@@ -96,8 +90,4 @@ Mailer
- ``assertEmailHeaderNotSame()``
- ``assertEmailAddressContains()``
-.. versionadded:: 4.4
-
- The mailer assert methods were introduced in Symfony 4.4.
-
.. _`symfony/panther`: https://github.com/symfony/panther
diff --git a/translation.rst b/translation.rst
index bc2f8e03a72..f1c224ba23d 100644
--- a/translation.rst
+++ b/translation.rst
@@ -292,12 +292,6 @@ To manage these situations, Symfony follows the `ICU MessageFormat`_ syntax by
using PHP's :phpclass:`MessageFormatter` class. Read more about this in
:doc:`/translation/message_format`.
-.. versionadded:: 4.2
-
- Support for ICU MessageFormat was introduced in Symfony 4.2. Prior to this,
- pluralization was managed by the
- :method:`Symfony\\Component\\Translation\\Translator::transChoice` method.
-
.. _translation-in-templates:
Translations in Templates
@@ -354,11 +348,6 @@ The ``translation:update`` command looks for missing translations in:
* Any PHP file/class that injects or :doc:`autowires `
the ``translator`` service and makes calls to the ``trans()`` function.
-.. versionadded:: 4.3
-
- The extraction of missing translation strings from PHP files was introduced
- in Symfony 4.3.
-
.. _translation-resource-locations:
Translation Resource/File Names and Locations
@@ -366,18 +355,11 @@ Translation Resource/File Names and Locations
Symfony looks for message files (i.e. translations) in the following default locations:
-#. the ``translations/`` directory (at the root of the project);
-#. the ``src/Resources//translations/`` directory;
-#. the ``Resources/translations/`` directory inside of any bundle.
-
-.. deprecated:: 4.2
-
- Using the ``src/Resources//translations/`` directory to store
- translations was deprecated in Symfony 4.2. Use instead the directory
- defined in the ``default_path`` option (which is ``translations/`` by default).
+* the ``translations/`` directory (at the root of the project);
+* the ``Resources/translations/`` directory inside of any bundle.
The locations are listed here with the highest priority first. That is, you can
-override the translation messages of a bundle in any of the top two directories.
+override the translation messages of a bundle in the first directory.
The override mechanism works at a key level: only the overridden keys need
to be listed in a higher priority message file. When a key is not found
@@ -477,13 +459,6 @@ if you're generating translations with specialized programs or teams.
:class:`Symfony\\Component\\Translation\\Loader\\LoaderInterface` interface.
See the :ref:`dic-tags-translation-loader` tag for more information.
-.. versionadded:: 4.3
-
- Starting from Symfony 4.3, when you create a new translation file (or
- install a bundle that includes translation files), you don't have to clear
- the cache with the command ``php bin/console cache:clear`` as you had to do
- in previous Symfony versions.
-
Handling the User's Locale
--------------------------
@@ -550,12 +525,6 @@ checks translation resources for several locales:
// ...
]);
-.. deprecated:: 4.4
-
- In Symfony versions before 4.4, the ``fallbacks`` option was initialized to
- ``en`` (English) when not configured explicitly. Starting from Symfony 4.4,
- this option is initialized to the same value as the ``default_locale`` option.
-
.. note::
When Symfony can't find a translation in the given locale, it will
diff --git a/translation/lint.rst b/translation/lint.rst
index 29cec3c5008..bcdd42eae9b 100644
--- a/translation/lint.rst
+++ b/translation/lint.rst
@@ -32,3 +32,16 @@ The linter results can be exported to JSON using the ``--format`` option:
$ php bin/console lint:yaml translations/ --format=json
$ php bin/console lint:xliff translations/ --format=json
+
+.. tip::
+
+ The Yaml component provides a stand-alone ``yaml-lint`` binary to lint YAML
+ files without using the entire Symfony console application:
+
+ .. code-block:: terminal
+
+ $ php vendor/bin/yaml-lint translations/
+
+ .. versionadded:: 5.1
+
+ The ``yaml-lint`` binary was introduced in Symfony 5.1.
diff --git a/translation/message_format.rst b/translation/message_format.rst
index 4c660c7023a..187b3513df5 100644
--- a/translation/message_format.rst
+++ b/translation/message_format.rst
@@ -4,10 +4,6 @@
How to Translate Messages using the ICU MessageFormat
=====================================================
-.. versionadded:: 4.2
-
- Support for ICU MessageFormat was introduced in Symfony 4.2.
-
Messages (i.e. strings) in applications are almost never completely static.
They contain variables or other complex logic like pluralization. In order to
handle this, the Translator component supports the `ICU MessageFormat`_ syntax.
diff --git a/translation/templates.rst b/translation/templates.rst
index 903f1934d92..b820bfb0fba 100644
--- a/translation/templates.rst
+++ b/translation/templates.rst
@@ -9,27 +9,13 @@ Twig Templates
Using Twig Tags
~~~~~~~~~~~~~~~
-Symfony provides specialized Twig tags (``trans`` and ``transchoice``) to
-help with message translation of *static blocks of text*:
+Symfony provides a specialized Twig tag ``trans`` to help with message
+translation of *static blocks of text*:
.. code-block:: twig
{% trans %}Hello %name%{% endtrans %}
- {% transchoice count %}
- {0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples
- {% endtranschoice %}
-
-The ``transchoice`` tag automatically gets the ``%count%`` variable from
-the current context and passes it to the translator. This mechanism only
-works when you use a placeholder following the ``%var%`` pattern.
-
-.. deprecated:: 4.2
-
- The ``transchoice`` tag is deprecated since Symfony 4.2 and will be
- removed in 5.0. Use the :doc:`ICU MessageFormat ` with
- the ``trans`` tag instead.
-
.. caution::
The ``%var%`` notation of placeholders is required when translating in
@@ -48,34 +34,19 @@ You can also specify the message domain and pass some additional variables:
{% trans with {'%name%': 'Fabien'} from 'app' into 'fr' %}Hello %name%{% endtrans %}
- {% transchoice count with {'%name%': 'Fabien'} from 'app' %}
- {0} %name%, there are no apples|{1} %name%, there is one apple|]1,Inf[ %name%, there are %count% apples
- {% endtranschoice %}
-
.. _translation-filters:
Using Twig Filters
~~~~~~~~~~~~~~~~~~
-The ``trans`` and ``transchoice`` filters can be used to translate *variable
-texts* and complex expressions:
+The ``trans`` filter can be used to translate *variable texts* and complex expressions:
.. code-block:: twig
{{ message|trans }}
- {{ message|transchoice(5) }}
-
{{ message|trans({'%name%': 'Fabien'}, 'app') }}
- {{ message|transchoice(5, {'%name%': 'Fabien'}, 'app') }}
-
-.. deprecated:: 4.2
-
- The ``transchoice`` filter is deprecated since Symfony 4.2 and will be
- removed in 5.0. Use the :doc:`ICU MessageFormat ` with
- the ``trans`` filter instead.
-
.. tip::
Using the translation tags or filters have the same effect, but with
@@ -116,8 +87,3 @@ The translator service is accessible in PHP templates through the
= $view['translator']->trans('Symfony is great') ?>
- = $view['translator']->transChoice(
- '{0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples',
- 10,
- ['%count%' => 10]
- ) ?>
diff --git a/validation/custom_constraint.rst b/validation/custom_constraint.rst
index 9af22a03480..69fcfe07ee1 100644
--- a/validation/custom_constraint.rst
+++ b/validation/custom_constraint.rst
@@ -93,11 +93,6 @@ The validator class is also simple, and only has one required method ``validate(
}
}
-.. versionadded:: 4.4
-
- The feature to allow passing an object as the ``buildViolation()`` argument
- was introduced in Symfony 4.4.
-
Inside ``validate``, you don't need to return a value. Instead, you add violations
to the validator's ``context`` property and a value will be considered valid
if it causes no violations. The ``buildViolation()`` method takes the error
diff --git a/workflow.rst b/workflow.rst
index db131726b85..21c9488ed01 100644
--- a/workflow.rst
+++ b/workflow.rst
@@ -345,16 +345,19 @@ order:
* ``workflow.[workflow name].announce``
* ``workflow.[workflow name].announce.[transition name]``
+ You can avoid triggering those events by using the context::
+
+ $workflow->apply($subject, $transitionName, [Workflow::DISABLE_ANNOUNCE_EVENT => true]);
+
+ .. versionadded:: 5.1
+
+ The ``Workflow::DISABLE_ANNOUNCE_EVENT`` constant was introduced in Symfony 5.1.
+
.. note::
The leaving and entering events are triggered even for transitions that stay
in same place.
-.. versionadded:: 4.3
-
- Following events are also dispatched when the subject enters the workflow
- for the first time: ``workflow.entered`` and ``workflow.[worflow name].entered``.
-
Here is an example of how to enable logging for every time a "blog_publishing"
workflow leaves a place::
@@ -549,10 +552,6 @@ place::
}
}
-.. versionadded:: 4.1
-
- The transition blockers were introduced in Symfony 4.1.
-
Usage in Twig
-------------
@@ -606,10 +605,6 @@ The following example shows these functions in action:
Storing Metadata
----------------
-.. versionadded:: 4.1
-
- The feature to store metadata in workflows was introduced in Symfony 4.1.
-
In case you need it, you can store arbitrary metadata in workflows, their
places, and their transitions using the ``metadata`` option. This metadata can
be as simple as the title of the workflow or as complex as your own application