Skip to content

Commit

Permalink
minor #5065 [Reference] fix code block order (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.3 branch.

Discussion
----------

[Reference] fix code block order

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets |

The new documentation standard for the order of code blocks in
validation contraint configurations is *Annotations*, *YAML*, *XML*,
*PHP*. This commit fixes the order of the configuration examples.

Commits
-------

4592564 fix code block order
  • Loading branch information
weaverryan committed Apr 15, 2015
2 parents 73ccc8b + 4592564 commit c40b618
Show file tree
Hide file tree
Showing 46 changed files with 534 additions and 534 deletions.
22 changes: 11 additions & 11 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -344,17 +344,6 @@ object.

.. configuration-block::

.. code-block:: yaml
# AppBundle/Resources/config/validation.yml
AppBundle\Entity\Task:
properties:
task:
- NotBlank: ~
dueDate:
- NotBlank: ~
- Type: \DateTime
.. code-block:: php-annotations
// AppBundle/Entity/Task.php
Expand All @@ -374,6 +363,17 @@ object.
protected $dueDate;
}
.. code-block:: yaml
# AppBundle/Resources/config/validation.yml
AppBundle\Entity\Task:
properties:
task:
- NotBlank: ~
dueDate:
- NotBlank: ~
- Type: \DateTime
.. code-block:: xml
<!-- AppBundle/Resources/config/validation.xml -->
Expand Down
18 changes: 9 additions & 9 deletions cookbook/doctrine/file_uploads.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,6 @@ rules::

.. configuration-block::

.. code-block:: yaml
# src/AppBundle/Resources/config/validation.yml
AppBundle\Entity\Document:
properties:
file:
- File:
maxSize: 6000000
.. code-block:: php-annotations
// src/AppBundle/Entity/Document.php
Expand All @@ -179,6 +170,15 @@ rules::
// ...
}
.. code-block:: yaml
# src/AppBundle/Resources/config/validation.yml
AppBundle\Entity\Document:
properties:
file:
- File:
maxSize: 6000000
.. code-block:: xml
<!-- src/AppBundle/Resources/config/validation.xml -->
Expand Down
32 changes: 16 additions & 16 deletions cookbook/validation/custom_constraint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,6 @@ Using custom validators is very easy, just as the ones provided by Symfony itsel

.. configuration-block::

.. code-block:: yaml
# src/AppBundle/Resources/config/validation.yml
AppBundle\Entity\AcmeEntity:
properties:
name:
- NotBlank: ~
- AppBundle\Validator\Constraints\ContainsAlphanumeric: ~
.. code-block:: php-annotations
// src/AppBundle/Entity/AcmeEntity.php
Expand All @@ -117,6 +108,15 @@ Using custom validators is very easy, just as the ones provided by Symfony itsel
// ...
}
.. code-block:: yaml
# src/AppBundle/Resources/config/validation.yml
AppBundle\Entity\AcmeEntity:
properties:
name:
- NotBlank: ~
- AppBundle\Validator\Constraints\ContainsAlphanumeric: ~
.. code-block:: xml
<!-- src/AppBundle/Resources/config/validation.xml -->
Expand Down Expand Up @@ -237,13 +237,6 @@ not to the property:

.. configuration-block::

.. code-block:: yaml
# src/AppBundle/Resources/config/validation.yml
AppBundle\Entity\AcmeEntity:
constraints:
- AppBundle\Validator\Constraints\ContainsAlphanumeric: ~
.. code-block:: php-annotations
/**
Expand All @@ -254,6 +247,13 @@ not to the property:
// ...
}
.. code-block:: yaml
# src/AppBundle/Resources/config/validation.yml
AppBundle\Entity\AcmeEntity:
constraints:
- AppBundle\Validator\Constraints\ContainsAlphanumeric: ~
.. code-block:: xml
<!-- src/AppBundle/Resources/config/validation.xml -->
Expand Down
22 changes: 11 additions & 11 deletions reference/constraints/All.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@ entry in that array:

.. configuration-block::

.. code-block:: yaml
# src/Acme/UserBundle/Resources/config/validation.yml
Acme\UserBundle\Entity\User:
properties:
favoriteColors:
- All:
- NotBlank: ~
- Length:
min: 5
.. code-block:: php-annotations
// src/Acme/UserBundle/Entity/User.php
Expand All @@ -51,6 +40,17 @@ entry in that array:
protected $favoriteColors = array();
}
.. code-block:: yaml
# src/Acme/UserBundle/Resources/config/validation.yml
Acme\UserBundle\Entity\User:
properties:
favoriteColors:
- All:
- NotBlank: ~
- Length:
min: 5
.. code-block:: xml
<!-- src/Acme/UserBundle/Resources/config/validation.xml -->
Expand Down
16 changes: 8 additions & 8 deletions reference/constraints/Blank.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ of an ``Author`` class were blank, you could do the following:

.. configuration-block::

.. code-block:: yaml
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\BlogBundle\Entity\Author:
properties:
firstName:
- Blank: ~
.. code-block:: php-annotations
// src/Acme/BlogBundle/Entity/Author.php
Expand All @@ -47,6 +39,14 @@ of an ``Author`` class were blank, you could do the following:
protected $firstName;
}
.. code-block:: yaml
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\BlogBundle\Entity\Author:
properties:
firstName:
- Blank: ~
.. code-block:: xml
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
Expand Down
34 changes: 17 additions & 17 deletions reference/constraints/Callback.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ Setup

.. configuration-block::

.. code-block:: yaml
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\BlogBundle\Entity\Author:
constraints:
- Callback:
methods: [isAuthorValid]
.. code-block:: php-annotations
// src/Acme/BlogBundle/Entity/Author.php
Expand All @@ -54,6 +46,14 @@ Setup
{
}
.. code-block:: yaml
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\BlogBundle\Entity\Author:
constraints:
- Callback:
methods: [isAuthorValid]
.. code-block:: xml
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
Expand Down Expand Up @@ -139,15 +139,6 @@ process. Each method can be one of the following formats:

.. configuration-block::

.. code-block:: yaml
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\BlogBundle\Entity\Author:
constraints:
- Callback:
methods:
- [Acme\BlogBundle\MyStaticValidatorClass, isAuthorValid]
.. code-block:: php-annotations
// src/Acme/BlogBundle/Entity/Author.php
Expand All @@ -162,6 +153,15 @@ process. Each method can be one of the following formats:
{
}
.. code-block:: yaml
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\BlogBundle\Entity\Author:
constraints:
- Callback:
methods:
- [Acme\BlogBundle\MyStaticValidatorClass, isAuthorValid]
.. code-block:: xml
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
Expand Down
30 changes: 15 additions & 15 deletions reference/constraints/CardScheme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ on an object that will contain a credit card number.

.. configuration-block::

.. code-block:: php-annotations
// src/Acme/SubscriptionBundle/Entity/Transaction.php
namespace Acme\SubscriptionBundle\Entity\Transaction;
use Symfony\Component\Validator\Constraints as Assert;
class Transaction
{
/**
* @Assert\CardScheme(schemes = {"VISA"}, message = "Your credit card number is invalid.")
*/
protected $cardNumber;
}
.. code-block:: yaml
# src/Acme/SubscriptionBundle/Resources/config/validation.yml
Expand Down Expand Up @@ -57,21 +72,6 @@ on an object that will contain a credit card number.
</class>
</constraint-mapping>
.. code-block:: php-annotations
// src/Acme/SubscriptionBundle/Entity/Transaction.php
namespace Acme\SubscriptionBundle\Entity\Transaction;
use Symfony\Component\Validator\Constraints as Assert;
class Transaction
{
/**
* @Assert\CardScheme(schemes = {"VISA"}, message = "Your credit card number is invalid.")
*/
protected $cardNumber;
}
.. code-block:: php
// src/Acme/SubscriptionBundle/Entity/Transaction.php
Expand Down
52 changes: 26 additions & 26 deletions reference/constraints/Choice.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ If your valid choice list is simple, you can pass them in directly via the

.. configuration-block::

.. code-block:: yaml
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\BlogBundle\Entity\Author:
properties:
gender:
- Choice:
choices: [male, female]
message: Choose a valid gender.
.. code-block:: php-annotations
// src/Acme/BlogBundle/Entity/Author.php
Expand All @@ -61,6 +51,16 @@ If your valid choice list is simple, you can pass them in directly via the
protected $gender;
}
.. code-block:: yaml
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\BlogBundle\Entity\Author:
properties:
gender:
- Choice:
choices: [male, female]
message: Choose a valid gender.
.. code-block:: xml
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
Expand Down Expand Up @@ -129,14 +129,6 @@ constraint.

.. configuration-block::

.. code-block:: yaml
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\BlogBundle\Entity\Author:
properties:
gender:
- Choice: { callback: getGenders }
.. code-block:: php-annotations
// src/Acme/BlogBundle/Entity/Author.php
Expand All @@ -152,6 +144,14 @@ constraint.
protected $gender;
}
.. code-block:: yaml
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\BlogBundle\Entity\Author:
properties:
gender:
- Choice: { callback: getGenders }
.. code-block:: xml
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
Expand Down Expand Up @@ -194,14 +194,6 @@ you can pass the class name and the method as an array.

.. configuration-block::

.. code-block:: yaml
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\BlogBundle\Entity\Author:
properties:
gender:
- Choice: { callback: [Util, getGenders] }
.. code-block:: php-annotations
// src/Acme/BlogBundle/Entity/Author.php
Expand All @@ -217,6 +209,14 @@ you can pass the class name and the method as an array.
protected $gender;
}
.. code-block:: yaml
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\BlogBundle\Entity\Author:
properties:
gender:
- Choice: { callback: [Util, getGenders] }
.. code-block:: xml
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
Expand Down
Loading

0 comments on commit c40b618

Please sign in to comment.