@@ -60,15 +60,6 @@ One way to accomplish this is with the Expression constraint:
6060
6161.. configuration-block ::
6262
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-
7263 .. code-block :: php-annotations
7364
7465 // src/AppBundle/Model/BlogPost.php
@@ -87,6 +78,15 @@ One way to accomplish this is with the Expression constraint:
8778 // ...
8879 }
8980
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+
9090 .. code-block :: xml
9191
9292 <!-- src/AppBundle/Resources/config/validation.xml -->
@@ -141,16 +141,6 @@ more about the expression language syntax, see
141141
142142 .. configuration-block ::
143143
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-
154144 .. code-block :: php-annotations
155145
156146 // src/AppBundle/Model/BlogPost.php
@@ -173,6 +163,16 @@ more about the expression language syntax, see
173163 // ...
174164 }
175165
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+
176176 .. code-block :: xml
177177
178178 <!-- src/AppBundle/Resources/config/validation.xml -->
0 commit comments