Skip to content

Commit e94987e

Browse files
committed
minor #14103 Remove manual enabling of validation and validator annotations (l-vo)
This PR was merged into the 4.4 branch. Discussion ---------- Remove manual enabling of validation and validator annotations According to [framework validation configuration](https://github.com/symfony/symfony/blob/88bf7211a9b648dfba519455f7f25f34d693df06/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php#L801), since Symfony standard edition doesn't exist anymore for 4.4: - Enabling validation is not needed anymore as long as `symfony/validator` is enabled - Enabling validation annotations is not needed anymore as long as `doctrine/annotations` is enabled Commits ------- af5401a Remove manual enabling of validation and validator annotations
2 parents dad83ee + af5401a commit e94987e

File tree

1 file changed

+1
-71
lines changed

1 file changed

+1
-71
lines changed

validation.rst

Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -212,77 +212,7 @@ Inside the template, you can output the list of errors exactly as needed:
212212
Configuration
213213
-------------
214214

215-
Before using the Symfony validator, make sure it's enabled in the main config
216-
file:
217-
218-
.. configuration-block::
219-
220-
.. code-block:: yaml
221-
222-
# config/packages/framework.yaml
223-
framework:
224-
validation: { enabled: true }
225-
226-
.. code-block:: xml
227-
228-
<!-- config/packages/framework.xml -->
229-
<?xml version="1.0" encoding="UTF-8" ?>
230-
<container xmlns="http://symfony.com/schema/dic/services"
231-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
232-
xmlns:framework="http://symfony.com/schema/dic/symfony"
233-
xsi:schemaLocation="http://symfony.com/schema/dic/services
234-
https://symfony.com/schema/dic/services/services-1.0.xsd
235-
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
236-
237-
<framework:config>
238-
<framework:validation enabled="true"/>
239-
</framework:config>
240-
</container>
241-
242-
.. code-block:: php
243-
244-
// config/packages/framework.php
245-
$container->loadFromExtension('framework', [
246-
'validation' => [
247-
'enabled' => true,
248-
],
249-
]);
250-
251-
Besides, if you plan to use annotations to configure validation, replace the
252-
previous configuration by the following:
253-
254-
.. configuration-block::
255-
256-
.. code-block:: yaml
257-
258-
# config/packages/framework.yaml
259-
framework:
260-
validation: { enable_annotations: true }
261-
262-
.. code-block:: xml
263-
264-
<!-- config/packages/framework.xml -->
265-
<?xml version="1.0" encoding="UTF-8" ?>
266-
<container xmlns="http://symfony.com/schema/dic/services"
267-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
268-
xmlns:framework="http://symfony.com/schema/dic/symfony"
269-
xsi:schemaLocation="http://symfony.com/schema/dic/services
270-
https://symfony.com/schema/dic/services/services-1.0.xsd
271-
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
272-
273-
<framework:config>
274-
<framework:validation enable-annotations="true"/>
275-
</framework:config>
276-
</container>
277-
278-
.. code-block:: php
279-
280-
// config/packages/framework.php
281-
$container->loadFromExtension('framework', [
282-
'validation' => [
283-
'enable_annotations' => true,
284-
],
285-
]);
215+
In the previous Symfony versions, enabling the validator in configuration was a requirement. It's not the case anymore, the validation is enabled by default as long as the Validator component is installed. In the same way, annotations are enabled by default if ``doctrine/annotations`` is installed.
286216

287217
.. tip::
288218

0 commit comments

Comments
 (0)