From 184bbd440f0634f6e03b3e005a58f173b864834e Mon Sep 17 00:00:00 2001 From: MichalWadowski Date: Tue, 1 Jul 2014 19:12:44 +0200 Subject: [PATCH] Allow to use closure in QueryExpression Allow to use closure in QueryExpression. Fixes #3852 --- src/Database/Expression/QueryExpression.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Database/Expression/QueryExpression.php b/src/Database/Expression/QueryExpression.php index 3f996e00532..1336d614230 100644 --- a/src/Database/Expression/QueryExpression.php +++ b/src/Database/Expression/QueryExpression.php @@ -434,6 +434,11 @@ protected function _addConditions(array $conditions, array $types) { 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;