Skip to content

Commit e3efbbf

Browse files
javiereguiluzweaverryan
authored andcommitted
Reordered the code blocks to show Annotations, YAML, XML and PHP
1 parent 39f46e1 commit e3efbbf

File tree

4 files changed

+132
-132
lines changed

4 files changed

+132
-132
lines changed

reference/constraints/GreaterThan.rst

+33-33
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ If you want to ensure that the ``age`` of a ``Person`` class is greater than
2929

3030
.. configuration-block::
3131

32-
.. code-block:: yaml
33-
34-
# src/Acme/SocialBundle/Resources/config/validation.yml
35-
Acme\SocialBundle\Entity\Person:
36-
properties:
37-
age:
38-
- GreaterThan:
39-
value: 18
40-
4132
.. code-block:: php-annotations
4233
4334
// src/Acme/SocialBundle/Entity/Person.php
@@ -55,6 +46,15 @@ If you want to ensure that the ``age`` of a ``Person`` class is greater than
5546
protected $age;
5647
}
5748
49+
.. code-block:: yaml
50+
51+
# src/Acme/SocialBundle/Resources/config/validation.yml
52+
Acme\SocialBundle\Entity\Person:
53+
properties:
54+
age:
55+
- GreaterThan:
56+
value: 18
57+
5858
.. code-block:: xml
5959
6060
<!-- src/Acme/SocialBundle/Resources/config/validation.xml -->
@@ -102,14 +102,6 @@ that a date must at least be the next day:
102102

103103
.. configuration-block::
104104

105-
.. code-block:: yaml
106-
107-
# src/Acme/OrderBundle/Resources/config/validation.yml
108-
Acme\OrderBundle\Entity\Order:
109-
properties:
110-
deliveryDate:
111-
- GreaterThan: today
112-
113105
.. code-block:: php-annotations
114106
115107
// src/Acme/OrderBundle/Entity/Order.php
@@ -125,6 +117,14 @@ that a date must at least be the next day:
125117
protected $deliveryDate;
126118
}
127119
120+
.. code-block:: yaml
121+
122+
# src/Acme/OrderBundle/Resources/config/validation.yml
123+
Acme\OrderBundle\Entity\Order:
124+
properties:
125+
deliveryDate:
126+
- GreaterThan: today
127+
128128
.. code-block:: xml
129129
130130
<!-- src/Acme/OrderBundle/Resources/config/validation.xml -->
@@ -161,14 +161,6 @@ dates. If you want to fix the timezone, append it to the date string:
161161

162162
.. configuration-block::
163163

164-
.. code-block:: yaml
165-
166-
# src/Acme/OrderBundle/Resources/config/validation.yml
167-
Acme\OrderBundle\Entity\Order:
168-
properties:
169-
deliveryDate:
170-
- GreaterThan: today UTC
171-
172164
.. code-block:: php-annotations
173165
174166
// src/Acme/OrderBundle/Entity/Order.php
@@ -184,6 +176,14 @@ dates. If you want to fix the timezone, append it to the date string:
184176
protected $deliveryDate;
185177
}
186178
179+
.. code-block:: yaml
180+
181+
# src/Acme/OrderBundle/Resources/config/validation.yml
182+
Acme\OrderBundle\Entity\Order:
183+
properties:
184+
deliveryDate:
185+
- GreaterThan: today UTC
186+
187187
.. code-block:: xml
188188
189189
<!-- src/Acme/OrderBundle/Resources/config/validation.xml -->
@@ -221,14 +221,6 @@ current time:
221221

222222
.. configuration-block::
223223

224-
.. code-block:: yaml
225-
226-
# src/Acme/OrderBundle/Resources/config/validation.yml
227-
Acme\OrderBundle\Entity\Order:
228-
properties:
229-
deliveryDate:
230-
- GreaterThan: +5 hours
231-
232224
.. code-block:: php-annotations
233225
234226
// src/Acme/OrderBundle/Entity/Order.php
@@ -244,6 +236,14 @@ current time:
244236
protected $deliveryDate;
245237
}
246238
239+
.. code-block:: yaml
240+
241+
# src/Acme/OrderBundle/Resources/config/validation.yml
242+
Acme\OrderBundle\Entity\Order:
243+
properties:
244+
deliveryDate:
245+
- GreaterThan: +5 hours
246+
247247
.. code-block:: xml
248248
249249
<!-- src/Acme/OrderBundle/Resources/config/validation.xml -->

reference/constraints/GreaterThanOrEqual.rst

+33-33
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,6 @@ or equal to ``18``, you could do the following:
2727

2828
.. configuration-block::
2929

30-
.. code-block:: yaml
31-
32-
# src/Acme/SocialBundle/Resources/config/validation.yml
33-
Acme\SocialBundle\Entity\Person:
34-
properties:
35-
age:
36-
- GreaterThanOrEqual:
37-
value: 18
38-
3930
.. code-block:: php-annotations
4031
4132
// src/Acme/SocialBundle/Entity/Person.php
@@ -53,6 +44,15 @@ or equal to ``18``, you could do the following:
5344
protected $age;
5445
}
5546
47+
.. code-block:: yaml
48+
49+
# src/Acme/SocialBundle/Resources/config/validation.yml
50+
Acme\SocialBundle\Entity\Person:
51+
properties:
52+
age:
53+
- GreaterThanOrEqual:
54+
value: 18
55+
5656
.. code-block:: xml
5757
5858
<!-- src/Acme/SocialBundle/Resources/config/validation.xml -->
@@ -100,14 +100,6 @@ that a date must at least be the current day:
100100

101101
.. configuration-block::
102102

103-
.. code-block:: yaml
104-
105-
# src/OrderBundle/Resources/config/validation.yml
106-
Acme\OrderBundle\Entity\Order:
107-
properties:
108-
deliveryDate:
109-
- GreaterThanOrEqual: today
110-
111103
.. code-block:: php-annotations
112104
113105
// src/Acme/SocialBundle/Entity/Order.php
@@ -123,6 +115,14 @@ that a date must at least be the current day:
123115
protected $deliveryDate;
124116
}
125117
118+
.. code-block:: yaml
119+
120+
# src/OrderBundle/Resources/config/validation.yml
121+
Acme\OrderBundle\Entity\Order:
122+
properties:
123+
deliveryDate:
124+
- GreaterThanOrEqual: today
125+
126126
.. code-block:: xml
127127
128128
<!-- src/Acme/OrderBundle/Resources/config/validation.xml -->
@@ -159,14 +159,6 @@ dates. If you want to fix the timezone, append it to the date string:
159159

160160
.. configuration-block::
161161

162-
.. code-block:: yaml
163-
164-
# src/OrderBundle/Resources/config/validation.yml
165-
Acme\OrderBundle\Entity\Order:
166-
properties:
167-
deliveryDate:
168-
- GreaterThanOrEqual: today UTC
169-
170162
.. code-block:: php-annotations
171163
172164
// src/Acme/SocialBundle/Entity/Order.php
@@ -182,6 +174,14 @@ dates. If you want to fix the timezone, append it to the date string:
182174
protected $deliveryDate;
183175
}
184176
177+
.. code-block:: yaml
178+
179+
# src/OrderBundle/Resources/config/validation.yml
180+
Acme\OrderBundle\Entity\Order:
181+
properties:
182+
deliveryDate:
183+
- GreaterThanOrEqual: today UTC
184+
185185
.. code-block:: xml
186186
187187
<!-- src/Acme/OrderBundle/Resources/config/validation.xml -->
@@ -219,14 +219,6 @@ current time:
219219

220220
.. configuration-block::
221221

222-
.. code-block:: yaml
223-
224-
# src/OrderBundle/Resources/config/validation.yml
225-
Acme\OrderBundle\Entity\Order:
226-
properties:
227-
deliveryDate:
228-
- GreaterThanOrEqual: +5 hours
229-
230222
.. code-block:: php-annotations
231223
232224
// src/Acme/SocialBundle/Entity/Order.php
@@ -242,6 +234,14 @@ current time:
242234
protected $deliveryDate;
243235
}
244236
237+
.. code-block:: yaml
238+
239+
# src/OrderBundle/Resources/config/validation.yml
240+
Acme\OrderBundle\Entity\Order:
241+
properties:
242+
deliveryDate:
243+
- GreaterThanOrEqual: +5 hours
244+
245245
.. code-block:: xml
246246
247247
<!-- src/Acme/OrderBundle/Resources/config/validation.xml -->

reference/constraints/LessThan.rst

+33-33
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ If you want to ensure that the ``age`` of a ``Person`` class is less than
2828

2929
.. configuration-block::
3030

31-
.. code-block:: yaml
32-
33-
# src/Acme/SocialBundle/Resources/config/validation.yml
34-
Acme\SocialBundle\Entity\Person:
35-
properties:
36-
age:
37-
- LessThan:
38-
value: 80
39-
4031
.. code-block:: php-annotations
4132
4233
// src/Acme/SocialBundle/Entity/Person.php
@@ -54,6 +45,15 @@ If you want to ensure that the ``age`` of a ``Person`` class is less than
5445
protected $age;
5546
}
5647
48+
.. code-block:: yaml
49+
50+
# src/Acme/SocialBundle/Resources/config/validation.yml
51+
Acme\SocialBundle\Entity\Person:
52+
properties:
53+
age:
54+
- LessThan:
55+
value: 80
56+
5757
.. code-block:: xml
5858
5959
<!-- src/Acme/SocialBundle/Resources/config/validation.xml -->
@@ -101,14 +101,6 @@ that a date must be in the past like this:
101101

102102
.. configuration-block::
103103

104-
.. code-block:: yaml
105-
106-
# src/SocialBundle/Resources/config/validation.yml
107-
Acme\SocialBundle\Entity\Person:
108-
properties:
109-
dateOfBirth:
110-
- LessThan: today
111-
112104
.. code-block:: php-annotations
113105
114106
// src/Acme/SocialBundle/Entity/Person.php
@@ -124,6 +116,14 @@ that a date must be in the past like this:
124116
protected $dateOfBirth;
125117
}
126118
119+
.. code-block:: yaml
120+
121+
# src/SocialBundle/Resources/config/validation.yml
122+
Acme\SocialBundle\Entity\Person:
123+
properties:
124+
dateOfBirth:
125+
- LessThan: today
126+
127127
.. code-block:: xml
128128
129129
<!-- src/Acme/SocialBundle/Resources/config/validation.xml -->
@@ -160,14 +160,6 @@ dates. If you want to fix the timezone, append it to the date string:
160160

161161
.. configuration-block::
162162

163-
.. code-block:: yaml
164-
165-
# src/SocialBundle/Resources/config/validation.yml
166-
Acme\SocialBundle\Entity\Person:
167-
properties:
168-
dateOfBirth:
169-
- LessThan: today UTC
170-
171163
.. code-block:: php-annotations
172164
173165
// src/Acme/SocialBundle/Entity/Person.php
@@ -183,6 +175,14 @@ dates. If you want to fix the timezone, append it to the date string:
183175
protected $dateOfBirth;
184176
}
185177
178+
.. code-block:: yaml
179+
180+
# src/SocialBundle/Resources/config/validation.yml
181+
Acme\SocialBundle\Entity\Person:
182+
properties:
183+
dateOfBirth:
184+
- LessThan: today UTC
185+
186186
.. code-block:: xml
187187
188188
<!-- src/Acme/SocialBundle/Resources/config/validation.xml -->
@@ -219,14 +219,6 @@ can check that a person must be at least 18 years old like this:
219219

220220
.. configuration-block::
221221

222-
.. code-block:: yaml
223-
224-
# src/SocialBundle/Resources/config/validation.yml
225-
Acme\SocialBundle\Entity\Person:
226-
properties:
227-
dateOfBirth:
228-
- LessThan: -18 years
229-
230222
.. code-block:: php-annotations
231223
232224
// src/Acme/SocialBundle/Entity/Person.php
@@ -242,6 +234,14 @@ can check that a person must be at least 18 years old like this:
242234
protected $dateOfBirth;
243235
}
244236
237+
.. code-block:: yaml
238+
239+
# src/SocialBundle/Resources/config/validation.yml
240+
Acme\SocialBundle\Entity\Person:
241+
properties:
242+
dateOfBirth:
243+
- LessThan: -18 years
244+
245245
.. code-block:: xml
246246
247247
<!-- src/Acme/SocialBundle/Resources/config/validation.xml -->

0 commit comments

Comments
 (0)