Allow to use closure in QueryExpression. Fixes #3852
@@ -434,6 +434,11 @@ class QueryExpression implements ExpressionInterface, Countable {
if ($numericKey && empty($c)) {
continue;
}
+
+ if (is_callable($c)) {
+ $expr = new QueryExpression([], $typeMap);
+ $c = $c($expr, $this);
+ }
if ($numericKey && is_string($c)) {
$this->_conditions[] = $c;