Commit fc98f263 authored by beberlei's avatar beberlei

DDC-127 - Commit missing changes to Query Error handling which make testsuite fail.

parent 3b9fd15d
...@@ -207,7 +207,16 @@ final class Query extends AbstractQuery ...@@ -207,7 +207,16 @@ final class Query extends AbstractQuery
$sqlParams = array(); $sqlParams = array();
$paramMappings = $this->_parserResult->getParameterMappings(); $paramMappings = $this->_parserResult->getParameterMappings();
if(count($paramMappings) != count($params)) {
throw new QueryException("Invalid parameter number: number of bound variables does not match number of tokens");
}
foreach ($params as $key => $value) { foreach ($params as $key => $value) {
if(!isset($paramMappings[$key])) {
throw new QueryException("Invalid parameter: token ".$key." is not defined in the query.");
}
if (is_object($value)) { if (is_object($value)) {
$values = $this->_em->getClassMetadata(get_class($value))->getIdentifierValues($value); $values = $this->_em->getClassMetadata(get_class($value))->getIdentifierValues($value);
$sqlPositions = $paramMappings[$key]; $sqlPositions = $paramMappings[$key];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment