Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #194 from sonata-project/addIdentifiersToQuery
Browse files Browse the repository at this point in the history
adjust to qb refactoring
  • Loading branch information
lsmith77 committed Oct 5, 2013
2 parents 8ba7543 + dfd4162 commit 56fb874
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions Model/ModelManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,20 +316,16 @@ public function getUrlsafeIdentifier($document)
*/
public function addIdentifiersToQuery($class, ProxyQueryInterface $queryProxy, array $idx)
{
/** @var $queryProxy ProxyQuery */
$qb = $queryProxy->getQueryBuilder();

$constraint = null;
$orX = $qb->andWhere()->orX();

foreach ($idx as $id) {
$path = $this->getBackendId($id);
$condition = $qb->expr()->eqPath($path);
if ($constraint) {
$constraint = $qb->expr()->orx($constraint, $condition);
} else {
$constraint = $condition;
}
// this selector depends on the default in self::createQuery not being changed
$orX->same($path, 'a');
}
$qb->andWhere($constraint);
}

/**
Expand Down

0 comments on commit 56fb874

Please sign in to comment.