Add SqlWalker::HINT_DISTINCT constant
This commit is contained in:
parent
d9bb861b1f
commit
8027fca378
@ -39,6 +39,11 @@ use Doctrine\DBAL\LockMode,
|
|||||||
*/
|
*/
|
||||||
class SqlWalker implements TreeWalker
|
class SqlWalker implements TreeWalker
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
const HINT_DISTINCT = 'doctrine.distinct';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ResultSetMapping
|
* @var ResultSetMapping
|
||||||
*/
|
*/
|
||||||
@ -591,7 +596,7 @@ class SqlWalker implements TreeWalker
|
|||||||
$sqlSelectExpressions = array_filter(array_map(array($this, 'walkSelectExpression'), $selectClause->selectExpressions));
|
$sqlSelectExpressions = array_filter(array_map(array($this, 'walkSelectExpression'), $selectClause->selectExpressions));
|
||||||
|
|
||||||
if ($this->_query->getHint(Query::HINT_INTERNAL_ITERATION) == true && $selectClause->isDistinct) {
|
if ($this->_query->getHint(Query::HINT_INTERNAL_ITERATION) == true && $selectClause->isDistinct) {
|
||||||
$this->_query->setHint('doctrine.distinct', true);
|
$this->_query->setHint(self::HINT_DISTINCT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$addMetaColumns = ! $this->_query->getHint(Query::HINT_FORCE_PARTIAL_LOAD) &&
|
$addMetaColumns = ! $this->_query->getHint(Query::HINT_FORCE_PARTIAL_LOAD) &&
|
||||||
@ -815,7 +820,7 @@ class SqlWalker implements TreeWalker
|
|||||||
|
|
||||||
// Ensure we got the owning side, since it has all mapping info
|
// Ensure we got the owning side, since it has all mapping info
|
||||||
$assoc = ( ! $relation['isOwningSide']) ? $targetClass->associationMappings[$relation['mappedBy']] : $relation;
|
$assoc = ( ! $relation['isOwningSide']) ? $targetClass->associationMappings[$relation['mappedBy']] : $relation;
|
||||||
if ($this->_query->getHint(Query::HINT_INTERNAL_ITERATION) == true && (!$this->_query->getHint('doctrine.distinct') || isset($this->_selectedClasses[$joinedDqlAlias]))) {
|
if ($this->_query->getHint(Query::HINT_INTERNAL_ITERATION) == true && (!$this->_query->getHint(self::HINT_DISTINCT) || isset($this->_selectedClasses[$joinedDqlAlias]))) {
|
||||||
if ($relation['type'] == ClassMetadata::ONE_TO_MANY || $relation['type'] == ClassMetadata::MANY_TO_MANY) {
|
if ($relation['type'] == ClassMetadata::ONE_TO_MANY || $relation['type'] == ClassMetadata::MANY_TO_MANY) {
|
||||||
throw QueryException::iterateWithFetchJoinNotAllowed($assoc);
|
throw QueryException::iterateWithFetchJoinNotAllowed($assoc);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user