Skip to content

Commit f1caeb3

Browse files
committed
Merge branch '2.1'
2 parents 23c8e48 + 4be1ae1 commit f1caeb3

20 files changed

+217
-40
lines changed

components/filesystem.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ Installation
1616
You can install the component in many different ways:
1717

1818
* Use the official Git repository (https://github.com/symfony/Filesystem);
19-
* Install it via PEAR ( `pear.symfony.com/Filesystem`);
20-
* Install it via Composer (`symfony/filesystem` on Packagist).
19+
* Install it via Composer (``symfony/filesystem`` on `Packagist`_).
2120

2221
Usage
2322
-----
@@ -240,3 +239,5 @@ thrown.
240239
returned a boolean and did not throw exceptions. As of 2.1, a
241240
:class:`Symfony\\Component\\Filesystem\\Exception\\IOException` is
242241
thrown if a directory creation fails.
242+
243+
.. _`Packagist`: https://packagist.org/packages/symfony/filesystem

components/routing/introduction.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,11 @@ If you're using the ``YamlFileLoader``, then route definitions look like this:
245245
# routes.yml
246246
route1:
247247
pattern: /foo
248-
defaults: { controller: 'MyController::fooAction' }
248+
defaults: { _controller: 'MyController::fooAction' }
249249
250250
route2:
251251
pattern: /foo/bar
252-
defaults: { controller: 'MyController::foobarAction' }
252+
defaults: { _controller: 'MyController::foobarAction' }
253253
254254
To load this file, you can use the following code. This assumes that your
255255
``routes.yml`` file is in the same directory as the below code::

reference/constraints/All.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,22 @@ entry in that array:
5151
protected $favoriteColors = array();
5252
}
5353
54+
.. code-block:: xml
55+
56+
<!-- src/Acme/UserBundle/Resources/config/validation.xml -->
57+
<class name="Acme\UserBundle\Entity\User">
58+
<property name="favoriteColors">
59+
<constraint name="All">
60+
<option name="constraints">
61+
<constraint name="NotBlank" />
62+
<constraint name="Length">
63+
<option name="min">5</option>
64+
</constraint>
65+
</option>
66+
</constraint>
67+
</property>
68+
</class>
69+
5470
Now, each entry in the ``favoriteColors`` array will be validated to not
5571
be blank and to be at least 5 characters long.
5672

reference/constraints/Choice.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ If your valid choice list is simple, you can pass them in directly via the
4949
.. code-block:: xml
5050
5151
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
52-
<class name="Acme\BlogBundle\EntityAuthor">
52+
<class name="Acme\BlogBundle\Entity\Author">
5353
<property name="gender">
5454
<constraint name="Choice">
5555
<option name="choices">
@@ -280,4 +280,4 @@ strict
280280

281281
If true, the validator will also check the type of the input value. Specifically,
282282
this value is passed to as the third argument to the PHP :phpfunction:`in_array` method
283-
when checking to see if a value is in the valid choices array.
283+
when checking to see if a value is in the valid choices array.

reference/constraints/Count.rst

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ you might add the following:
3838
- Count:
3939
min: 1
4040
max: 5
41-
minMessage: You must specify at least one email
42-
maxMessage: You cannot specify more than 5 emails
41+
minMessage: "You must specify at least one email"
42+
maxMessage: "You cannot specify more than {{ limit }} emails"
4343
4444
.. code-block:: php-annotations
4545
@@ -53,12 +53,27 @@ you might add the following:
5353
* min = "1",
5454
* max = "5",
5555
* minMessage = "You must specify at least one email",
56-
* maxMessage = "You cannot specify more than 5 emails"
56+
* maxMessage = "You cannot specify more than {{ limit }} emails"
5757
* )
5858
*/
5959
protected $emails = array();
6060
}
6161
62+
.. code-block:: xml
63+
64+
<!-- src/Acme/EventBundle/Resources/config/validation.xml -->
65+
<class name="Acme\EventBundle\Entity\Participant">
66+
<property name="emails">
67+
<constraint name="Count">
68+
<option name="min">1</option>
69+
<option name="max">5</option>
70+
<option name="minMessage">You must specify at least one email</option>
71+
<option name="maxMessage">You cannot specify more than {{ limit }} emails</option>
72+
</constraint>
73+
</property>
74+
</class>
75+
76+
6277
Options
6378
-------
6479

reference/constraints/Country.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ Basic Usage
4141
protected $country;
4242
}
4343
44+
.. code-block:: xml
45+
46+
<!-- src/Acme/UserBundle/Resources/config/validation.xml -->
47+
<class name="Acme\UserBundle\Entity\User">
48+
<property name="country">
49+
<constraint name="Country" />
50+
</property>
51+
</class>
52+
4453
Options
4554
-------
4655

reference/constraints/Date.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ Basic Usage
4141
protected $birthday;
4242
}
4343
44+
.. code-block:: xml
45+
46+
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
47+
<class name="Acme\BlogBundle\Entity\Author">
48+
<property name="birthday">
49+
<constraint name="Date" />
50+
</property>
51+
</class>
52+
4453
Options
4554
-------
4655

reference/constraints/DateTime.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ Basic Usage
4343
protected $createdAt;
4444
}
4545
46+
.. code-block:: xml
47+
48+
<!-- src/Acme/UserBundle/Resources/config/validation.xml -->
49+
<class name="Acme\BlogBundle\Entity\Author">
50+
<property name="createdAt">
51+
<constraint name="DateTime" />
52+
</property>
53+
</class>
54+
4655
Options
4756
-------
4857

reference/constraints/False.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ method returns **false**:
4848
- "False":
4949
message: You've entered an invalid state.
5050
51+
.. code-block:: xml
52+
53+
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
54+
<class name="Acme\BlogBundle\Entity\Author">
55+
<getter property="stateInvalid">
56+
<constraint name="False">
57+
<option name="message">You've entered an invalid state.</option>
58+
</constraint>
59+
</getter>
60+
</class>
61+
5162
.. code-block:: php-annotations
5263
5364
// src/Acme/BlogBundle/Entity/Author.php

reference/constraints/Ip.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ Basic Usage
4444
protected $ipAddress;
4545
}
4646
47+
.. code-block:: xml
48+
49+
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
50+
<class name="Acme\BlogBundle\Entity\Author">
51+
<property name="ipAddress">
52+
<constraint name="Ip" />
53+
</property>
54+
</class>
55+
4756
Options
4857
-------
4958

0 commit comments

Comments
 (0)