Skip to content

[Reference] fix code block order #5065

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
Apr 15, 2015
Merged
Show file tree
Hide file tree
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
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