Skip to content

Make Annotations the first configuration on Expression constraint #8793

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
Dec 1, 2017
Merged
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: 19 additions & 19 deletions reference/constraints/Expression.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ One way to accomplish this is with the Expression constraint:

.. configuration-block::

.. code-block:: yaml

# src/AppBundle/Resources/config/validation.yml
AppBundle\Model\BlogPost:
constraints:
- Expression:
expression: "this.getCategory() in ['php', 'symfony'] or !this.isTechnicalPost()"
message: "If this is a tech post, the category should be either php or symfony!"

.. code-block:: php-annotations

// src/AppBundle/Model/BlogPost.php
Expand All @@ -87,6 +78,15 @@ One way to accomplish this is with the Expression constraint:
// ...
}

.. code-block:: yaml

# src/AppBundle/Resources/config/validation.yml
AppBundle\Model\BlogPost:
constraints:
- Expression:
expression: "this.getCategory() in ['php', 'symfony'] or !this.isTechnicalPost()"
message: "If this is a tech post, the category should be either php or symfony!"

.. code-block:: xml

<!-- src/AppBundle/Resources/config/validation.xml -->
Expand Down Expand Up @@ -141,16 +141,6 @@ more about the expression language syntax, see

.. configuration-block::

.. code-block:: yaml

# src/AppBundle/Resources/config/validation.yml
AppBundle\Model\BlogPost:
properties:
isTechnicalPost:
- Expression:
expression: "this.getCategory() in ['php', 'symfony'] or value == false"
message: "If this is a tech post, the category should be either php or symfony!"

.. code-block:: php-annotations

// src/AppBundle/Model/BlogPost.php
Expand All @@ -173,6 +163,16 @@ more about the expression language syntax, see
// ...
}

.. code-block:: yaml

# src/AppBundle/Resources/config/validation.yml
AppBundle\Model\BlogPost:
properties:
isTechnicalPost:
- Expression:
expression: "this.getCategory() in ['php', 'symfony'] or value == false"
message: "If this is a tech post, the category should be either php or symfony!"

.. code-block:: xml

<!-- src/AppBundle/Resources/config/validation.xml -->
Expand Down