File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,18 @@ One way to accomplish this is with the Expression constraint:
128
128
// ...
129
129
}
130
130
131
+ .. versionadded :: 2.6
132
+ Since Symfony 2.6, the Expression constraint doesn't skip ``null `` values.
133
+
134
+ Before Symfony 2.6, the Expression constraint didn't validate ``null `` values.
135
+ To preserve this behavior, you'll have to allow ``null `` values explicitly.
136
+ For example, to allow blog posts without a category, your expression will
137
+ look like this:
138
+
139
+ .. code-block :: text
140
+
141
+ this.getCategory() === null or this.getCategory() in ["php", "symfony"] or !this.isTechnicalPost()
142
+
131
143
The :ref: `expression <reference-constraint-expression-option >` option is the
132
144
expression that must return true in order for validation to pass. To learn
133
145
more about the expression language syntax, see
You can’t perform that action at this time.
0 commit comments