Fixed bug with boolean values being converted to string.
This commit is contained in:
parent
2518f0687c
commit
772b413579
@ -1126,8 +1126,9 @@ class SqlWalker implements TreeWalker
|
|||||||
if ( ! isset($this->_selectedClasses[$dqlAlias])) {
|
if ( ! isset($this->_selectedClasses[$dqlAlias])) {
|
||||||
$this->_selectedClasses[$dqlAlias] = $class;
|
$this->_selectedClasses[$dqlAlias] = $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
$beginning = true;
|
$beginning = true;
|
||||||
|
|
||||||
// Select all fields from the queried class
|
// Select all fields from the queried class
|
||||||
foreach ($class->fieldMappings as $fieldName => $mapping) {
|
foreach ($class->fieldMappings as $fieldName => $mapping) {
|
||||||
if ($partialFieldSet && !in_array($fieldName, $partialFieldSet)) {
|
if ($partialFieldSet && !in_array($fieldName, $partialFieldSet)) {
|
||||||
@ -1146,6 +1147,7 @@ class SqlWalker implements TreeWalker
|
|||||||
. ' AS ' . $columnAlias;
|
. ' AS ' . $columnAlias;
|
||||||
|
|
||||||
$columnAlias = $this->_platform->getSQLResultCasing($columnAlias);
|
$columnAlias = $this->_platform->getSQLResultCasing($columnAlias);
|
||||||
|
|
||||||
$this->_rsm->addFieldResult($dqlAlias, $columnAlias, $fieldName, $class->name);
|
$this->_rsm->addFieldResult($dqlAlias, $columnAlias, $fieldName, $class->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1157,6 +1159,7 @@ class SqlWalker implements TreeWalker
|
|||||||
foreach ($class->subClasses as $subClassName) {
|
foreach ($class->subClasses as $subClassName) {
|
||||||
$subClass = $this->_em->getClassMetadata($subClassName);
|
$subClass = $this->_em->getClassMetadata($subClassName);
|
||||||
$sqlTableAlias = $this->getSQLTableAlias($subClass->getTableName(), $dqlAlias);
|
$sqlTableAlias = $this->getSQLTableAlias($subClass->getTableName(), $dqlAlias);
|
||||||
|
|
||||||
foreach ($subClass->fieldMappings as $fieldName => $mapping) {
|
foreach ($subClass->fieldMappings as $fieldName => $mapping) {
|
||||||
if (isset($mapping['inherited']) || $partialFieldSet && !in_array($fieldName, $partialFieldSet)) {
|
if (isset($mapping['inherited']) || $partialFieldSet && !in_array($fieldName, $partialFieldSet)) {
|
||||||
continue;
|
continue;
|
||||||
@ -1178,8 +1181,10 @@ class SqlWalker implements TreeWalker
|
|||||||
if ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE && ! isset($assoc['inherited'])) {
|
if ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE && ! isset($assoc['inherited'])) {
|
||||||
foreach ($assoc['targetToSourceKeyColumns'] as $srcColumn) {
|
foreach ($assoc['targetToSourceKeyColumns'] as $srcColumn) {
|
||||||
if ($beginning) $beginning = false; else $sql .= ', ';
|
if ($beginning) $beginning = false; else $sql .= ', ';
|
||||||
|
|
||||||
$columnAlias = $this->getSQLColumnAlias($srcColumn);
|
$columnAlias = $this->getSQLColumnAlias($srcColumn);
|
||||||
$sql .= $sqlTableAlias . '.' . $srcColumn . ' AS ' . $columnAlias;
|
$sql .= $sqlTableAlias . '.' . $srcColumn . ' AS ' . $columnAlias;
|
||||||
|
|
||||||
$this->_rsm->addMetaResult($dqlAlias, $this->_platform->getSQLResultCasing($columnAlias), $srcColumn);
|
$this->_rsm->addMetaResult($dqlAlias, $this->_platform->getSQLResultCasing($columnAlias), $srcColumn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1845,12 +1850,16 @@ class SqlWalker implements TreeWalker
|
|||||||
switch ($literal->type) {
|
switch ($literal->type) {
|
||||||
case AST\Literal::STRING:
|
case AST\Literal::STRING:
|
||||||
return $this->_conn->quote($literal->value);
|
return $this->_conn->quote($literal->value);
|
||||||
|
|
||||||
case AST\Literal::BOOLEAN:
|
case AST\Literal::BOOLEAN:
|
||||||
$bool = strtolower($literal->value) == 'true' ? true : false;
|
$bool = strtolower($literal->value) == 'true' ? true : false;
|
||||||
$boolVal = $this->_conn->getDatabasePlatform()->convertBooleans($bool);
|
$boolVal = $this->_conn->getDatabasePlatform()->convertBooleans($bool);
|
||||||
return is_string($boolVal) ? $this->_conn->quote($boolVal) : $boolVal;
|
|
||||||
|
return $boolVal;
|
||||||
|
|
||||||
case AST\Literal::NUMERIC:
|
case AST\Literal::NUMERIC:
|
||||||
return $literal->value;
|
return $literal->value;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw QueryException::invalidLiteral($literal);
|
throw QueryException::invalidLiteral($literal);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user