@@ -207,77 +207,7 @@ Inside the template, you can output the list of errors exactly as needed:
207207Configuration
208208-------------
209209
210- Before using the Symfony validator, make sure it's enabled in the main config
211- file:
212-
213- .. configuration-block ::
214-
215- .. code-block :: yaml
216-
217- # config/packages/framework.yaml
218- framework :
219- validation : { enabled: true }
220-
221- .. code-block :: xml
222-
223- <!-- config/packages/framework.xml -->
224- <?xml version =" 1.0" encoding =" UTF-8" ?>
225- <container xmlns =" http://symfony.com/schema/dic/services"
226- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
227- xmlns : framework =" http://symfony.com/schema/dic/symfony"
228- xsi : schemaLocation =" http://symfony.com/schema/dic/services
229- https://symfony.com/schema/dic/services/services-1.0.xsd
230- http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
231-
232- <framework : config >
233- <framework : validation enabled =" true" />
234- </framework : config >
235- </container >
236-
237- .. code-block :: php
238-
239- // config/packages/framework.php
240- $container->loadFromExtension('framework', [
241- 'validation' => [
242- 'enabled' => true,
243- ],
244- ]);
245-
246- Besides, if you plan to use annotations to configure validation, replace the
247- previous configuration by the following:
248-
249- .. configuration-block ::
250-
251- .. code-block :: yaml
252-
253- # config/packages/framework.yaml
254- framework :
255- validation : { enable_annotations: true }
256-
257- .. code-block :: xml
258-
259- <!-- config/packages/framework.xml -->
260- <?xml version =" 1.0" encoding =" UTF-8" ?>
261- <container xmlns =" http://symfony.com/schema/dic/services"
262- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
263- xmlns : framework =" http://symfony.com/schema/dic/symfony"
264- xsi : schemaLocation =" http://symfony.com/schema/dic/services
265- https://symfony.com/schema/dic/services/services-1.0.xsd
266- http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
267-
268- <framework : config >
269- <framework : validation enable-annotations =" true" />
270- </framework : config >
271- </container >
272-
273- .. code-block :: php
274-
275- // config/packages/framework.php
276- $container->loadFromExtension('framework', [
277- 'validation' => [
278- 'enable_annotations' => true,
279- ],
280- ]);
210+ 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.
281211
282212.. tip ::
283213
0 commit comments