@@ -60,15 +60,6 @@ One way to accomplish this is with the Expression constraint:
60
60
61
61
.. configuration-block ::
62
62
63
- .. code-block :: yaml
64
-
65
- # src/AppBundle/Resources/config/validation.yml
66
- AppBundle\Model\BlogPost :
67
- constraints :
68
- - Expression :
69
- expression : " this.getCategory() in ['php', 'symfony'] or !this.isTechnicalPost()"
70
- message : " If this is a tech post, the category should be either php or symfony!"
71
-
72
63
.. code-block :: php-annotations
73
64
74
65
// src/AppBundle/Model/BlogPost.php
@@ -87,6 +78,15 @@ One way to accomplish this is with the Expression constraint:
87
78
// ...
88
79
}
89
80
81
+ .. code-block :: yaml
82
+
83
+ # src/AppBundle/Resources/config/validation.yml
84
+ AppBundle\Model\BlogPost :
85
+ constraints :
86
+ - Expression :
87
+ expression : " this.getCategory() in ['php', 'symfony'] or !this.isTechnicalPost()"
88
+ message : " If this is a tech post, the category should be either php or symfony!"
89
+
90
90
.. code-block :: xml
91
91
92
92
<!-- src/AppBundle/Resources/config/validation.xml -->
@@ -141,16 +141,6 @@ more about the expression language syntax, see
141
141
142
142
.. configuration-block ::
143
143
144
- .. code-block :: yaml
145
-
146
- # src/AppBundle/Resources/config/validation.yml
147
- AppBundle\Model\BlogPost :
148
- properties :
149
- isTechnicalPost :
150
- - Expression :
151
- expression : " this.getCategory() in ['php', 'symfony'] or value == false"
152
- message : " If this is a tech post, the category should be either php or symfony!"
153
-
154
144
.. code-block :: php-annotations
155
145
156
146
// src/AppBundle/Model/BlogPost.php
@@ -173,6 +163,16 @@ more about the expression language syntax, see
173
163
// ...
174
164
}
175
165
166
+ .. code-block :: yaml
167
+
168
+ # src/AppBundle/Resources/config/validation.yml
169
+ AppBundle\Model\BlogPost :
170
+ properties :
171
+ isTechnicalPost :
172
+ - Expression :
173
+ expression : " this.getCategory() in ['php', 'symfony'] or value == false"
174
+ message : " If this is a tech post, the category should be either php or symfony!"
175
+
176
176
.. code-block :: xml
177
177
178
178
<!-- src/AppBundle/Resources/config/validation.xml -->
0 commit comments