diff --git a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php index b96aec46c..2ec9ac30c 100644 --- a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php @@ -809,17 +809,23 @@ class BasicEntityPersister } $persister = $this; - $valueVisitor = new SqlValueVisitor( - function ($field, $value) use($persister) { - return $persister->getType($field, $value); - }, - function ($value) use($persister) { - return $persister->getValue($value); - } - ); + $valueVisitor = new SqlValueVisitor(); $valueVisitor->dispatch($expression); - return $valueVisitor->getParamsAndTypes(); + list($values, $types) = $valueVisitor->getParamsAndTypes(); + + $sqlValues = array(); + foreach ($values as $value) { + $sqlValues[] = $this->getValue($value); + } + + $sqlTypes = array(); + foreach ($types as $type) { + list($field, $value) = $type; + $sqlTypes[] = $this->getType($field, $value); + } + + return array($sqlValues, $sqlTypes); } /** diff --git a/lib/Doctrine/ORM/Persisters/SqlValueVisitor.php b/lib/Doctrine/ORM/Persisters/SqlValueVisitor.php index ac07f827a..aa4d68d39 100644 --- a/lib/Doctrine/ORM/Persisters/SqlValueVisitor.php +++ b/lib/Doctrine/ORM/Persisters/SqlValueVisitor.php @@ -46,38 +46,6 @@ class SqlValueVisitor extends ExpressionVisitor */ private $types = array(); - /** - * Type Callback - * - * Called by this visitor to determine the type of a value - * - * @var callable - */ - private $typeCallback; - - /** - * Value Callback - * - * Called by this visitor to generate a sql value from the given value - * - * Callback is passed two parameters: - * - `Field` name of the field in a comparison - * - `Value` value in a comparison - * - * @var callable - */ - private $valueCallback; - - /** - * @param callable $typeCallback Type Resolution Callback - * @param callable $valueCallback Value Resolution Callback - */ - public function __construct($typeCallback, $valueCallback) - { - $this->typeCallback = $typeCallback; - $this->valueCallback = $valueCallback; - } - /** * Convert a comparison expression into the target query language output * @@ -87,14 +55,11 @@ class SqlValueVisitor extends ExpressionVisitor */ public function walkComparison(Comparison $comparison) { - $typeCallback = $this->typeCallback; - $valueCallback = $this->valueCallback; - $value = $comparison->getValue()->getValue(); $field = $comparison->getField(); - $this->values[] = $valueCallback($value); - $this->types[] = $typeCallback($field, $value); + $this->values[] = $value; + $this->types[] = array($field, $value); } /**