/** * Get the query after matching with given specification. * * @param SpecificationInterface $specification * @param ModifierInterface $modifier * * @throws LogicException * * @return Query */ public function match(SpecificationInterface $specification, ModifierInterface $modifier = null) { if (!$specification->isSatisfiedBy($this->getEntityName())) { throw new LogicException(sprintf('Specification "%s" not supported by this repository!', get_class($specification))); } $queryBuilder = $this->createQueryBuilder($this->dqlAlias); $this->modifyQueryBuilder($queryBuilder, $specification); return $this->modifyQuery($queryBuilder, $modifier); }
/** * Get the query after matching with given specification. * * @param SpecificationInterface $specification * @param ModifierInterface $resultModifier * * @throws LogicException * * @return Query */ public function match(SpecificationInterface $specification, ModifierInterface $resultModifier = null) { if (!$specification->isSatisfiedBy($this->getEntityName())) { throw new LogicException(sprintf('Specification "%s" not supported by this repository!', get_class($specification))); } $dqlAlias = $this->dqlAlias; $queryBuilder = $this->createQueryBuilder($dqlAlias); $condition = $specification->modify($queryBuilder, $dqlAlias); if (!empty($condition)) { $queryBuilder->where($condition); } $query = $queryBuilder->getQuery(); if ($resultModifier) { $resultModifier->modify($query); } return $query; }
/** * {@inheritdoc} */ public function isSatisfiedBy($value) { return $this->parent->isSatisfiedBy($value); }