Permalink
Browse files

Add SqlWalker::HINT_DISTINCT constant

  • Loading branch information...
1 parent d9bb861 commit 8027fca378a3c5992d30a07f606dd0f0fbcee2a1 @rande rande committed with beberlei Jan 24, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/Doctrine/ORM/Query/SqlWalker.php
@@ -40,6 +40,11 @@
class SqlWalker implements TreeWalker
{
/**
+ * @var string
+ */
+ const HINT_DISTINCT = 'doctrine.distinct';
+
+ /**
* @var ResultSetMapping
*/
private $_rsm;
@@ -591,7 +596,7 @@ public function walkSelectClause($selectClause)
$sqlSelectExpressions = array_filter(array_map(array($this, 'walkSelectExpression'), $selectClause->selectExpressions));
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) &&
@@ -815,7 +820,7 @@ public function walkJoinVariableDeclaration($joinVarDecl)
// Ensure we got the owning side, since it has all mapping info
$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) {
throw QueryException::iterateWithFetchJoinNotAllowed($assoc);
}

0 comments on commit 8027fca

Please sign in to comment.