1
0
mirror of synced 2025-01-20 15:31:40 +03:00

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

This commit is contained in:
beberlei 2009-11-21 12:33:30 +00:00
parent 3b9fd15dd6
commit fc98f26371

View File

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