Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit206a98d

Browse files
committed
minor#5651 [Reference][Constraints] follow best practices in the constraints reference (xabbuh)
This PR was merged into the 2.7 branch.Discussion----------[Reference][Constraints] follow best practices in the constraints reference| Q | A| ------------- | ---| Doc fix? | yes| New docs? | no| Applies to | 2.7+| Fixed tickets |This completes the work done by@wouterj in#5645 by updating the docs that were added for Symfony 2.6/2.7.Commits-------bfca2b7 follow best practices in the constraints reference
2 parentsc93a948 +bfca2b7 commit206a98d

File tree

11 files changed

+164
-163
lines changed

11 files changed

+164
-163
lines changed

‎reference/constraints/Callback.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ You can then use the following configuration to invoke this validator:
186186
..code-block::php-annotations
187187
188188
// src/AppBundle/Entity/Author.php
189-
namespaceAcme\BlogBundle\Entity;
189+
namespaceAppBundle\Entity;
190190
191191
use Symfony\Component\Validator\Constraints as Assert;
192192

‎reference/constraints/Expression.rst

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ Basic Usage
2424
Imagine you have a class ``BlogPost`` with ``category`` and ``isTechnicalPost``
2525
properties::
2626

27-
namespace Acme\DemoBundle\Model;
27+
// src/AppBundle/Model/BlogPost.php
28+
namespace AppBundle\Model;
2829

2930
use Symfony\Component\Validator\Constraints as Assert;
3031

@@ -61,17 +62,17 @@ One way to accomplish this is with the Expression constraint:
6162

6263
..code-block::yaml
6364
64-
# src/Acme/DemoBundle/Resources/config/validation.yml
65-
Acme\DemoBundle\Model\BlogPost:
65+
# src/AppBundle/Resources/config/validation.yml
66+
AppBundle\Model\BlogPost:
6667
constraints:
6768
-Expression:
6869
expression:"this.getCategory() in ['php', 'symfony'] or !this.isTechnicalPost()"
6970
message:"If this is a tech post, the category should be either php or symfony!"
7071
7172
..code-block::php-annotations
7273
73-
// src/Acme/DemoBundle/Model/BlogPost.php
74-
namespaceAcme\DemoBundle\Model;
74+
// src/AppBundle/Model/BlogPost.php
75+
namespaceAppBundle\Model;
7576
7677
use Symfony\Component\Validator\Constraints as Assert;
7778
@@ -88,12 +89,12 @@ One way to accomplish this is with the Expression constraint:
8889
8990
..code-block::xml
9091
91-
<!-- src/Acme/DemoBundle/Resources/config/validation.xml-->
92+
<!-- src/AppBundle/Resources/config/validation.xml-->
9293
<?xml version="1.0" encoding="UTF-8" ?>
9394
<constraint-mappingxmlns="http://symfony.com/schema/dic/constraint-mapping"
9495
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9596
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
96-
<classname="Acme\DemoBundle\Model\BlogPost">
97+
<classname="AppBundle\Model\BlogPost">
9798
<constraintname="Expression">
9899
<optionname="expression">
99100
this.getCategory() in ['php', 'symfony'] or !this.isTechnicalPost()
@@ -107,8 +108,8 @@ One way to accomplish this is with the Expression constraint:
107108
108109
..code-block::php
109110
110-
// src/Acme/DemoBundle/Model/BlogPost.php
111-
namespaceAcme\DemoBundle\Model;
111+
// src/AppBundle/Model/BlogPost.php
112+
namespaceAppBundle\Model;
112113
113114
use Symfony\Component\Validator\Mapping\ClassMetadata;
114115
use Symfony\Component\Validator\Constraints as Assert;
@@ -142,8 +143,8 @@ more about the expression language syntax, see
142143

143144
..code-block::yaml
144145
145-
# src/Acme/DemoBundle/Resources/config/validation.yml
146-
Acme\DemoBundle\Model\BlogPost:
146+
# src/AppBundle/Resources/config/validation.yml
147+
AppBundle\Model\BlogPost:
147148
properties:
148149
isTechnicalPost:
149150
-Expression:
@@ -152,8 +153,8 @@ more about the expression language syntax, see
152153
153154
..code-block::php-annotations
154155
155-
// src/Acme/DemoBundle/Model/BlogPost.php
156-
namespaceAcme\DemoBundle\Model;
156+
// src/AppBundle/Model/BlogPost.php
157+
namespaceAppBundle\Model;
157158
158159
use Symfony\Component\Validator\Constraints as Assert;
159160
@@ -174,13 +175,13 @@ more about the expression language syntax, see
174175
175176
..code-block::xml
176177
177-
<!-- src/Acme/DemoBundle/Resources/config/validation.xml-->
178+
<!-- src/AppBundle/Resources/config/validation.xml-->
178179
<?xml version="1.0" encoding="UTF-8" ?>
179180
<constraint-mappingxmlns="http://symfony.com/schema/dic/constraint-mapping"
180181
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
181182
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
182183
183-
<classname="Acme\DemoBundle\Model\BlogPost">
184+
<classname="AppBundle\Model\BlogPost">
184185
<propertyname="isTechnicalPost">
185186
<constraintname="Expression">
186187
<optionname="expression">
@@ -196,8 +197,8 @@ more about the expression language syntax, see
196197
197198
..code-block::php
198199
199-
// src/Acme/DemoBundle/Model/BlogPost.php
200-
namespaceAcme\DemoBundle\Model;
200+
// src/AppBundle/Model/BlogPost.php
201+
namespaceAppBundle\Model;
201202
202203
use Symfony\Component\Validator\Constraints as Assert;
203204
use Symfony\Component\Validator\Mapping\ClassMetadata;

‎reference/constraints/GreaterThan.rst

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ that a date must at least be the next day:
104104

105105
..code-block::php-annotations
106106
107-
// src/Acme/OrderBundle/Entity/Order.php
108-
namespaceAcme\OrderBundle\Entity;
107+
// src/AppBundle/Entity/Order.php
108+
namespaceAppBundle\Entity;
109109
110110
use Symfony\Component\Validator\Constraints as Assert;
111111
@@ -119,21 +119,21 @@ that a date must at least be the next day:
119119
120120
..code-block::yaml
121121
122-
# src/Acme/OrderBundle/Resources/config/validation.yml
123-
Acme\OrderBundle\Entity\Order:
122+
# src/AppBundle/Resources/config/validation.yml
123+
AppBundle\Entity\Order:
124124
properties:
125125
deliveryDate:
126126
-GreaterThan:today
127127
128128
..code-block::xml
129129
130-
<!-- src/Acme/OrderBundle/Resources/config/validation.xml-->
130+
<!-- src/AppBundle/Resources/config/validation.xml-->
131131
<?xml version="1.0" encoding="UTF-8" ?>
132132
<constraint-mappingxmlns="http://symfony.com/schema/dic/constraint-mapping"
133133
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
134134
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
135135
136-
<classname="Acme\OrderBundle\Entity\Order">
136+
<classname="AppBundle\Entity\Order">
137137
<propertyname="deliveryDate">
138138
<constraintname="GreaterThan">today</constraint>
139139
</property>
@@ -142,8 +142,8 @@ that a date must at least be the next day:
142142
143143
..code-block::php
144144
145-
// src/Acme/OrderBundle/Entity/Order.php
146-
namespaceAcme\OrderBundle\Entity;
145+
// src/AppBundle/Entity/Order.php
146+
namespaceAppBundle\Entity;
147147
148148
use Symfony\Component\Validator\Mapping\ClassMetadata;
149149
use Symfony\Component\Validator\Constraints as Assert;
@@ -163,8 +163,8 @@ dates. If you want to fix the timezone, append it to the date string:
163163

164164
..code-block::php-annotations
165165
166-
// src/Acme/OrderBundle/Entity/Order.php
167-
namespaceAcme\OrderBundle\Entity;
166+
// src/AppBundle/Entity/Order.php
167+
namespaceAppBundle\Entity;
168168
169169
use Symfony\Component\Validator\Constraints as Assert;
170170
@@ -178,21 +178,21 @@ dates. If you want to fix the timezone, append it to the date string:
178178
179179
..code-block::yaml
180180
181-
# src/Acme/OrderBundle/Resources/config/validation.yml
182-
Acme\OrderBundle\Entity\Order:
181+
# src/AppBundle/Resources/config/validation.yml
182+
AppBundle\Entity\Order:
183183
properties:
184184
deliveryDate:
185185
-GreaterThan:today UTC
186186
187187
..code-block::xml
188188
189-
<!-- src/Acme/OrderBundle/Resources/config/validation.xml-->
189+
<!-- src/AppBundle/Resources/config/validation.xml-->
190190
<?xml version="1.0" encoding="UTF-8" ?>
191191
<constraint-mappingxmlns="http://symfony.com/schema/dic/constraint-mapping"
192192
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
193193
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
194194
195-
<classname="Acme\OrderBundle\Entity\Order">
195+
<classname="AppBundle\Entity\Order">
196196
<propertyname="deliveryDate">
197197
<constraintname="GreaterThan">today UTC</constraint>
198198
</property>
@@ -201,8 +201,8 @@ dates. If you want to fix the timezone, append it to the date string:
201201
202202
..code-block::php
203203
204-
// src/Acme/OrderBundle/Entity/Order.php
205-
namespaceAcme\OrderBundle\Entity;
204+
// src/AppBundle/Entity/Order.php
205+
namespaceAppBundle\Entity;
206206
207207
use Symfony\Component\Validator\Mapping\ClassMetadata;
208208
use Symfony\Component\Validator\Constraints as Assert;
@@ -223,8 +223,8 @@ current time:
223223

224224
..code-block::php-annotations
225225
226-
// src/Acme/OrderBundle/Entity/Order.php
227-
namespaceAcme\OrderBundle\Entity;
226+
// src/AppBundle/Entity/Order.php
227+
namespaceAppBundle\Entity;
228228
229229
use Symfony\Component\Validator\Constraints as Assert;
230230
@@ -238,21 +238,21 @@ current time:
238238
239239
..code-block::yaml
240240
241-
# src/Acme/OrderBundle/Resources/config/validation.yml
242-
Acme\OrderBundle\Entity\Order:
241+
# src/AppBundle/Resources/config/validation.yml
242+
AppBundle\Entity\Order:
243243
properties:
244244
deliveryDate:
245245
-GreaterThan:+5 hours
246246
247247
..code-block::xml
248248
249-
<!-- src/Acme/OrderBundle/Resources/config/validation.xml-->
249+
<!-- src/AppBundle/Resources/config/validation.xml-->
250250
<?xml version="1.0" encoding="UTF-8" ?>
251251
<constraint-mappingxmlns="http://symfony.com/schema/dic/constraint-mapping"
252252
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
253253
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
254254
255-
<classname="Acme\OrderBundle\Entity\Order">
255+
<classname="AppBundle\Entity\Order">
256256
<propertyname="deliveryDate">
257257
<constraintname="GreaterThan">+5 hours</constraint>
258258
</property>
@@ -261,8 +261,8 @@ current time:
261261
262262
..code-block::php
263263
264-
// src/Acme/OrderBundle/Entity/Order.php
265-
namespaceAcme\OrderBundle\Entity;
264+
// src/AppBundle/Entity/Order.php
265+
namespaceAppBundle\Entity;
266266
267267
use Symfony\Component\Validator\Mapping\ClassMetadata;
268268
use Symfony\Component\Validator\Constraints as Assert;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp