Exemplo n.º 1
0
 /**
  * Generate query expression for a Criterion this handler accepts
  *
  * accept() must be called before calling this method.
  *
  * @param \eZ\Publish\Core\Persistence\Legacy\Content\Search\Gateway\CriteriaConverter$converter
  * @param \ezcQuerySelect $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion$criterion
  *
  * @return \ezcQueryExpression
  */
 public function handle(CriteriaConverter $converter, ezcQuerySelect $query, Criterion $criterion)
 {
     $subexpressions = array();
     foreach ($criterion->criteria as $subCriterion) {
         $subexpressions[] = $converter->convertCriteria($query, $subCriterion);
     }
     return $query->expr->lOr($subexpressions);
 }
 /**
  * Get query condition
  *
  * @param Criterion $criterion
  * @param \ezcQuerySelect $query
  * @param mixed $translations
  *
  * @return string
  */
 protected function getQueryCondition(Criterion $criterion, ezcQuerySelect $query, $translations)
 {
     $condition = $query->expr->lAnd($this->criteriaConverter->convertCriteria($query, $criterion), $query->expr->eq('ezcontentobject_version.status', VersionInfo::STATUS_PUBLISHED));
     if ($translations === null) {
         return $condition;
     }
     $translationQuery = $query->subSelect();
     $translationQuery->select($this->handler->quoteColumn('contentobject_id'))->from($this->handler->quoteTable('ezcontentobject_attribute'))->where($translationQuery->expr->in($this->handler->quoteColumn('language_code'), $translations));
     return $query->expr->lAnd($condition, $query->expr->in($this->handler->quoteColumn('id'), $translationQuery));
 }
Exemplo n.º 3
0
 /**
  * Generate query expression for a Criterion this handler accepts
  *
  * accept() must be called before calling this method.
  *
  * @param \eZ\Publish\Core\Persistence\Legacy\Content\Search\Gateway\CriteriaConverter$converter
  * @param \ezcQuerySelect $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion$criterion
  *
  * @return \ezcQueryExpression
  */
 public function handle(CriteriaConverter $converter, ezcQuerySelect $query, Criterion $criterion)
 {
     return $query->expr->not($converter->convertCriteria($query, $criterion->criteria[0]));
 }