Skip to content

Better explain how to enable the validation component and its annotations #7836

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

Closed
wants to merge 2 commits into from
Closed
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
38 changes: 36 additions & 2 deletions validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,42 @@ Configuration
-------------

Before using the Symfony validator, make sure it's enabled in the main config
file. Besides, if you plan to use annotations to configure validation, make sure
that the ``enable_annotations`` option is ``true``:
file:

.. configuration-block::

.. code-block:: yaml

# app/config/config.yml
framework:
validation: { enabled: true }

.. code-block:: xml

<!-- app/config/config.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"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<framework:validation enabled="true" />
</framework:config>
</container>

.. code-block:: php

// app/config/config.php
$container->loadFromExtension('framework', array(
'validation' => array(
'enabled' => true,
),
));

Besides, if you plan to use annotations to configure validation, replace the
previous configuration by the following:

.. configuration-block::

Expand Down