Browse Source

Allow to use closure in QueryExpression

Allow to use closure in QueryExpression. Fixes #3852
MichalWadowski 11 years ago
parent
commit
184bbd440f
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/Database/Expression/QueryExpression.php

+ 5 - 0
src/Database/Expression/QueryExpression.php

@@ -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;