当前位置: 首页>>代码示例>>PHP>>正文


PHP Database\SelectQuery类代码示例

本文整理汇总了PHP中eZ\Publish\Core\Persistence\Database\SelectQuery的典型用法代码示例。如果您正苦于以下问题:PHP SelectQuery类的具体用法?PHP SelectQuery怎么用?PHP SelectQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SelectQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 /**
  * Generate query expression for a Criterion this handler accepts.
  *
  * accept() must be called before calling this method.
  *
  * @param \eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter $converter
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  * @param array $fieldFilters
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  */
 public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion, array $fieldFilters = null)
 {
     /** @var \Netgen\TagsBundle\API\Repository\Values\Content\Query\Criterion\Value\TagKeywordValue $valueData */
     $valueData = $criterion->valueData;
     $subSelect = $query->subSelect();
     $subSelect->select($this->dbHandler->quoteColumn('id', 'ezcontentobject'))->from($this->dbHandler->quoteTable('ezcontentobject'))->innerJoin($this->dbHandler->quoteTable('eztags_attribute_link'), $subSelect->expr->lAnd(array($subSelect->expr->eq($this->dbHandler->quoteColumn('objectattribute_version', 'eztags_attribute_link'), $this->dbHandler->quoteColumn('current_version', 'ezcontentobject')), $subSelect->expr->eq($this->dbHandler->quoteColumn('object_id', 'eztags_attribute_link'), $this->dbHandler->quoteColumn('id', 'ezcontentobject')))))->innerJoin($this->dbHandler->quoteTable('eztags'), $subSelect->expr->eq($this->dbHandler->quoteColumn('keyword_id', 'eztags_attribute_link'), $this->dbHandler->quoteColumn('id', 'eztags')))->leftJoin($this->dbHandler->quoteTable('eztags_keyword'), $subSelect->expr->lAnd($subSelect->expr->eq($this->dbHandler->quoteColumn('id', 'eztags'), $this->dbHandler->quoteColumn('keyword_id', 'eztags_keyword')), $subSelect->expr->eq($this->dbHandler->quoteColumn('status', 'eztags_keyword'), $subSelect->bindValue(1, null, \PDO::PARAM_INT))));
     if ($valueData !== null && !empty($valueData->languages)) {
         if ($valueData->useAlwaysAvailable) {
             $subSelect->where($subSelect->expr->lOr($subSelect->expr->in($this->dbHandler->quoteColumn('locale', 'eztags_keyword'), $valueData->languages), $subSelect->expr->eq($this->dbHandler->quoteColumn('main_language_id', 'eztags'), $subSelect->expr->bitAnd($this->dbHandler->quoteColumn('language_id', 'eztags_keyword'), -2))));
         } else {
             $subSelect->where($subSelect->expr->in($this->dbHandler->quoteColumn('locale', 'eztags_keyword'), $valueData->languages));
         }
     }
     if ($criterion->operator == Criterion\Operator::LIKE) {
         $subSelect->where($subSelect->expr->like($this->dbHandler->quoteColumn('keyword', 'eztags_keyword'), $subSelect->bindValue($criterion->value[0])));
     } else {
         $subSelect->where($subSelect->expr->in($this->dbHandler->quoteColumn('keyword', 'eztags_keyword'), $criterion->value));
     }
     $fieldDefinitionIds = $this->getSearchableFields($criterion->target);
     if ($fieldDefinitionIds !== null) {
         $subSelect->innerJoin($this->dbHandler->quoteTable('ezcontentobject_attribute'), $subSelect->expr->lAnd(array($subSelect->expr->eq($this->dbHandler->quoteColumn('id', 'ezcontentobject_attribute'), $this->dbHandler->quoteColumn('objectattribute_id', 'eztags_attribute_link')), $subSelect->expr->eq($this->dbHandler->quoteColumn('version', 'ezcontentobject_attribute'), $this->dbHandler->quoteColumn('objectattribute_version', 'eztags_attribute_link')))));
         $subSelect->where($query->expr->in($this->dbHandler->quoteColumn('contentclassattribute_id', 'ezcontentobject_attribute'), $fieldDefinitionIds));
     }
     return $query->expr->in($this->dbHandler->quoteColumn('id', 'ezcontentobject'), $subSelect);
 }
开发者ID:umanit,项目名称:TagsBundle,代码行数:37,代码来源:TagKeyword.php

示例2: handle

 /**
  * 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\Common\Gateway\CriteriaConverter $converter
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  * @throws RuntimeException
  */
 public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion)
 {
     $column = $this->dbHandler->quoteColumn('to_contentobject_id', 'ezcontentobject_link');
     switch ($criterion->operator) {
         case Criterion\Operator::CONTAINS:
             if (count($criterion->value) > 1) {
                 $subRequest = array();
                 foreach ($criterion->value as $value) {
                     $subSelect = $query->subSelect();
                     $subSelect->select($this->dbHandler->quoteColumn('from_contentobject_id'))->from($this->dbHandler->quoteTable('ezcontentobject_link'));
                     $subSelect->innerJoin('ezcontentclass_attribute', $subSelect->expr->eq('ezcontentclass_attribute.id', 'ezcontentobject_link.contentclassattribute_id'));
                     $subSelect->where($subSelect->expr->lAnd($subSelect->expr->eq($this->dbHandler->quoteColumn('from_contentobject_version', 'ezcontentobject_link'), $this->dbHandler->quoteColumn('current_version', 'ezcontentobject')), $subSelect->expr->eq($this->dbHandler->quoteColumn('contentclass_id', 'ezcontentclass_attribute'), $this->dbHandler->quoteColumn('contentclass_id', 'ezcontentobject')), $subSelect->expr->eq($this->dbHandler->quoteColumn('identifier', 'ezcontentclass_attribute'), $subSelect->bindValue($criterion->target)), $subSelect->expr->eq($column, $value)));
                     $subRequest[] = $subSelect->expr->in($this->dbHandler->quoteColumn('id', 'ezcontentobject'), $subSelect);
                 }
                 return $query->expr->lAnd($subRequest);
             }
         case Criterion\Operator::IN:
             $subSelect = $query->subSelect();
             $subSelect->select($this->dbHandler->quoteColumn('from_contentobject_id'))->from($this->dbHandler->quoteTable('ezcontentobject_link'));
             $subSelect->innerJoin('ezcontentclass_attribute', $subSelect->expr->eq('ezcontentclass_attribute.id', 'ezcontentobject_link.contentclassattribute_id'));
             return $query->expr->in($this->dbHandler->quoteColumn('id', 'ezcontentobject'), $subSelect->where($subSelect->expr->lAnd($subSelect->expr->eq($this->dbHandler->quoteColumn('from_contentobject_version', 'ezcontentobject_link'), $this->dbHandler->quoteColumn('current_version', 'ezcontentobject')), $subSelect->expr->eq($this->dbHandler->quoteColumn('contentclass_id', 'ezcontentclass_attribute'), $this->dbHandler->quoteColumn('contentclass_id', 'ezcontentobject')), $subSelect->expr->eq($this->dbHandler->quoteColumn('identifier', 'ezcontentclass_attribute'), $subSelect->bindValue($criterion->target)), $subSelect->expr->in($column, $criterion->value))));
         default:
             throw new RuntimeException("Unknown operator '{$criterion->operator}' for RelationList criterion handler.");
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:37,代码来源:FieldRelation.php

示例3: handle

 /**
  * Generate query expression for a Criterion this handler accepts.
  *
  * accept() must be called before calling this method.
  *
  * @throws \RuntimeException
  *
  * @param \eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter $converter
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  * @param array $languageSettings
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  */
 public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion, array $languageSettings)
 {
     $column = $this->dbHandler->quoteColumn('to_contentobject_id', 'ezcontentobject_link');
     $fieldDefinitionIds = $this->getFieldDefinitionsIds($criterion->target);
     switch ($criterion->operator) {
         case Criterion\Operator::CONTAINS:
             if (count($criterion->value) > 1) {
                 $subRequest = array();
                 foreach ($criterion->value as $value) {
                     $subSelect = $query->subSelect();
                     $subSelect->select($this->dbHandler->quoteColumn('from_contentobject_id'))->from($this->dbHandler->quoteTable('ezcontentobject_link'));
                     $subSelect->where($subSelect->expr->lAnd($subSelect->expr->eq($this->dbHandler->quoteColumn('from_contentobject_version', 'ezcontentobject_link'), $this->dbHandler->quoteColumn('current_version', 'ezcontentobject')), $subSelect->expr->in($this->dbHandler->quoteColumn('contentclassattribute_id', 'ezcontentobject_link'), $fieldDefinitionIds), $subSelect->expr->eq($column, $value)));
                     $subRequest[] = $subSelect->expr->in($this->dbHandler->quoteColumn('id', 'ezcontentobject'), $subSelect);
                 }
                 return $query->expr->lAnd($subRequest);
             }
             // Intentionally omitting break
         // Intentionally omitting break
         case Criterion\Operator::IN:
             $subSelect = $query->subSelect();
             $subSelect->select($this->dbHandler->quoteColumn('from_contentobject_id'))->from($this->dbHandler->quoteTable('ezcontentobject_link'));
             return $query->expr->in($this->dbHandler->quoteColumn('id', 'ezcontentobject'), $subSelect->where($subSelect->expr->lAnd($subSelect->expr->eq($this->dbHandler->quoteColumn('from_contentobject_version', 'ezcontentobject_link'), $this->dbHandler->quoteColumn('current_version', 'ezcontentobject')), $subSelect->expr->in($this->dbHandler->quoteColumn('contentclassattribute_id', 'ezcontentobject_link'), $fieldDefinitionIds), $subSelect->expr->in($column, $criterion->value))));
         default:
             throw new RuntimeException("Unknown operator '{$criterion->operator}' for RelationList criterion handler.");
     }
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:40,代码来源:FieldRelation.php

示例4: getFieldCondition

 /**
  * Returns a field language join condition for the given $languageSettings.
  *
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param array $languageSettings
  *
  * @return string
  */
 protected function getFieldCondition(SelectQuery $query, array $languageSettings)
 {
     // 1. Use main language(s) by default
     if (empty($languageSettings['languages'])) {
         return $query->expr->gt($query->expr->bitAnd($this->dbHandler->quoteColumn('initial_language_id', 'ezcontentobject'), $this->dbHandler->quoteColumn('language_id', 'ezcontentobject_attribute')), $query->bindValue(0, null, PDO::PARAM_INT));
     }
     // 2. Otherwise use prioritized languages
     $leftSide = $query->expr->bitAnd($query->expr->sub($this->dbHandler->quoteColumn('language_mask', 'ezcontentobject'), $query->expr->bitAnd($this->dbHandler->quoteColumn('language_mask', 'ezcontentobject'), $this->dbHandler->quoteColumn('language_id', 'ezcontentobject_attribute'))), $query->bindValue(1, null, PDO::PARAM_INT));
     $rightSide = $query->expr->bitAnd($this->dbHandler->quoteColumn('language_id', 'ezcontentobject_attribute'), $query->bindValue(1, null, PDO::PARAM_INT));
     for ($index = count($languageSettings['languages']) - 1, $multiplier = 2; $index >= 0; $index--, $multiplier *= 2) {
         $languageId = $this->languageHandler->loadByLanguageCode($languageSettings['languages'][$index])->id;
         $addToLeftSide = $query->expr->bitAnd($query->expr->sub($this->dbHandler->quoteColumn('language_mask', 'ezcontentobject'), $query->expr->bitAnd($this->dbHandler->quoteColumn('language_mask', 'ezcontentobject'), $this->dbHandler->quoteColumn('language_id', 'ezcontentobject_attribute'))), $languageId);
         $addToRightSide = $query->expr->bitAnd($this->dbHandler->quoteColumn('language_id', 'ezcontentobject_attribute'), $languageId);
         if ($multiplier > $languageId) {
             $factor = $multiplier / $languageId;
             for ($shift = 0; $factor > 1; $factor = $factor / 2, $shift++) {
             }
             $factorTerm = ' << ' . $shift;
             $addToLeftSide .= $factorTerm;
             $addToRightSide .= $factorTerm;
         } elseif ($multiplier < $languageId) {
             $factor = $languageId / $multiplier;
             for ($shift = 0; $factor > 1; $factor = $factor / 2, $shift++) {
             }
             $factorTerm = ' >> ' . $shift;
             $addToLeftSide .= $factorTerm;
             $addToRightSide .= $factorTerm;
         }
         $leftSide = $query->expr->add($leftSide, "({$addToLeftSide})");
         $rightSide = $query->expr->add($rightSide, "({$addToRightSide})");
     }
     return $query->expr->lAnd($query->expr->gt($query->expr->bitAnd($this->dbHandler->quoteColumn('language_mask', 'ezcontentobject'), $this->dbHandler->quoteColumn('language_id', 'ezcontentobject_attribute')), $query->bindValue(0, null, PDO::PARAM_INT)), $query->expr->lt($leftSide, $rightSide));
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:41,代码来源:FieldBase.php

示例5: handle

 /**
  * Generates query expression for operator and value of a Field Criterion.
  *
  * @throws \RuntimeException If operator is not handled.
  *
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  * @param string $column
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  */
 public function handle(SelectQuery $query, Criterion $criterion, $column)
 {
     $column = $this->dbHandler->quoteColumn($column);
     switch ($criterion->operator) {
         case Criterion\Operator::IN:
             $filter = $query->expr->in($column, array_map(array($this, 'lowercase'), $criterion->value));
             break;
         case Criterion\Operator::BETWEEN:
             $filter = $query->expr->between($column, $query->bindValue($this->lowercase($criterion->value[0])), $query->bindValue($this->lowercase($criterion->value[1])));
             break;
         case Criterion\Operator::EQ:
         case Criterion\Operator::GT:
         case Criterion\Operator::GTE:
         case Criterion\Operator::LT:
         case Criterion\Operator::LTE:
         case Criterion\Operator::LIKE:
             $operatorFunction = $this->comparatorMap[$criterion->operator];
             $filter = $query->expr->{$operatorFunction}($column, $query->bindValue($this->lowercase($criterion->value)));
             break;
         case Criterion\Operator::CONTAINS:
             $filter = $query->expr->like($column, $query->bindValue("%" . $this->lowercase($criterion->value) . "%"));
             break;
         default:
             throw new RuntimeException("Unknown operator '{$criterion->operator}' for Field criterion handler.");
     }
     return $filter;
 }
开发者ID:nlescure,项目名称:ezpublish-kernel,代码行数:38,代码来源:Handler.php

示例6: handle

 /**
  * Generate query expression for a Criterion this handler accepts.
  *
  * accept() must be called before calling this method.
  *
  * @param \eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter $converter
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  * @param array $languageSettings
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  */
 public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion, array $languageSettings)
 {
     $statements = array();
     foreach ($criterion->value as $pattern) {
         $statements[] = $query->expr->like($this->dbHandler->quoteColumn('path_string', 'ezcontentobject_tree'), $query->bindValue($pattern . '%'));
     }
     return $query->expr->lOr($statements);
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:20,代码来源:Subtree.php

示例7: handle

 /**
  * 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\Common\Gateway\CriteriaConverter $converter
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  */
 public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion)
 {
     $table = $this->getUniqueTableName();
     $statements = array();
     foreach ($criterion->value as $pattern) {
         $statements[] = $query->expr->like($this->dbHandler->quoteColumn('path_string', $table), $query->bindValue($pattern . '%'));
     }
     $query->leftJoin($query->alias($this->dbHandler->quoteTable('ezcontentobject_tree'), $this->dbHandler->quoteIdentifier($table)), $query->expr->eq($this->dbHandler->quoteColumn('contentobject_id', $table), $this->dbHandler->quoteColumn('id', 'ezcontentobject')));
     return $query->expr->lOr($statements);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:21,代码来源:Subtree.php

示例8: handle

 /**
  * Generate query expression for a Criterion this handler accepts.
  *
  * accept() must be called before calling this method.
  *
  * @todo: Needs optimisation since this subselect can potentially be problematic
  * due to large number of contentobject_id values returned. One way to fix this
  * is to use inner joins on ezcontentobject_tree table, but this is not currently
  * supported in legacy search gateway
  *
  * @param \eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter $converter
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  * @param array $languageSettings
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  */
 public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion, array $languageSettings)
 {
     $subSelect = $query->subSelect();
     if ($criterion->value[0] === Criterion\Visibility::VISIBLE) {
         $expression = $query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn('is_hidden', 'ezcontentobject_tree'), 0), $query->expr->eq($this->dbHandler->quoteColumn('is_invisible', 'ezcontentobject_tree'), 0));
     } else {
         $expression = $query->expr->lOr($query->expr->eq($this->dbHandler->quoteColumn('is_hidden', 'ezcontentobject_tree'), 1), $query->expr->eq($this->dbHandler->quoteColumn('is_invisible', 'ezcontentobject_tree'), 1));
     }
     $subSelect->select($this->dbHandler->quoteColumn('contentobject_id'))->from($this->dbHandler->quoteTable('ezcontentobject_tree'))->where($expression);
     return $query->expr->in($this->dbHandler->quoteColumn('id', 'ezcontentobject'), $subSelect);
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:28,代码来源:Visibility.php

示例9: handle

 /**
  * Generates query expression for operator and value of a Field Criterion.
  *
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  * @param string $column
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  */
 public function handle(SelectQuery $query, Criterion $criterion, $column)
 {
     switch ($criterion->operator) {
         case Criterion\Operator::CONTAINS:
             $filter = $query->expr->eq($this->dbHandler->quoteColumn($column), $query->bindValue($this->lowerCase($criterion->value)));
             break;
         default:
             $filter = parent::handle($query, $criterion, $column);
     }
     return $filter;
 }
开发者ID:nlescure,项目名称:ezpublish-kernel,代码行数:20,代码来源:Simple.php

示例10: handle

 /**
  * 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\Common\Gateway\CriteriaConverter $converter
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  */
 public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion)
 {
     $subSelect = $query->subSelect();
     $subSelect->select($this->dbHandler->quoteColumn('id', 'ezcontentobject'))->from($this->dbHandler->quoteTable('ezcontentobject'))->innerJoin($this->dbHandler->quoteTable('eztags_attribute_link'), $subSelect->expr->lAnd(array($subSelect->expr->eq($this->dbHandler->quoteColumn('objectattribute_version', 'eztags_attribute_link'), $this->dbHandler->quoteColumn('current_version', 'ezcontentobject')), $subSelect->expr->eq($this->dbHandler->quoteColumn('object_id', 'eztags_attribute_link'), $this->dbHandler->quoteColumn('id', 'ezcontentobject')))))->where($query->expr->in($this->dbHandler->quoteColumn('keyword_id', 'eztags_attribute_link'), $criterion->value));
     $fieldDefinitionIds = $this->getSearchableFields($criterion->target);
     if ($fieldDefinitionIds !== null) {
         $subSelect->innerJoin($this->dbHandler->quoteTable('ezcontentobject_attribute'), $subSelect->expr->lAnd(array($subSelect->expr->eq($this->dbHandler->quoteColumn('id', 'ezcontentobject_attribute'), $this->dbHandler->quoteColumn('objectattribute_id', 'eztags_attribute_link')), $subSelect->expr->eq($this->dbHandler->quoteColumn('version', 'ezcontentobject_attribute'), $this->dbHandler->quoteColumn('objectattribute_version', 'eztags_attribute_link')))));
         $subSelect->where($query->expr->in($this->dbHandler->quoteColumn('contentclassattribute_id', 'ezcontentobject_attribute'), $fieldDefinitionIds));
     }
     return $query->expr->in($this->dbHandler->quoteColumn('id', 'ezcontentobject'), $subSelect);
 }
开发者ID:robertdamoc,项目名称:TagsBundle,代码行数:22,代码来源:TagId.php

示例11: handle

 /**
  * Generate query expression for a Criterion this handler accepts.
  *
  * accept() must be called before calling this method.
  *
  * @param \eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter $converter
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  * @param array $languageSettings
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  */
 public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion, array $languageSettings)
 {
     $idSet = array();
     foreach ($criterion->value as $value) {
         foreach (explode('/', trim($value, '/')) as $id) {
             $idSet[$id] = true;
         }
     }
     $subSelect = $query->subSelect();
     $subSelect->select($this->dbHandler->quoteColumn('contentobject_id'))->from($this->dbHandler->quoteTable('ezcontentobject_tree'))->where($query->expr->in($this->dbHandler->quoteColumn('node_id'), array_keys($idSet)));
     return $query->expr->in($this->dbHandler->quoteColumn('id', 'ezcontentobject'), $subSelect);
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:24,代码来源:Ancestor.php

示例12: handle

 /**
  * 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\Common\Gateway\CriteriaConverter $converter
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion$criterion
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  */
 public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion)
 {
     $column = $this->dbHandler->quoteColumn('is_invisible', 'ezcontentobject_tree');
     switch ($criterion->value[0]) {
         case Criterion\Visibility::VISIBLE:
             return $query->expr->eq($column, $query->bindValue(0, null, PDO::PARAM_INT));
         case Criterion\Visibility::HIDDEN:
             return $query->expr->eq($column, $query->bindValue(1, null, PDO::PARAM_INT));
         default:
             throw new RuntimeException("Unknown value '{$criterion->value[0]}' for Visibility criterion handler.");
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:23,代码来源:Visibility.php

示例13: applyJoin

 /**
  * Applies joins to the query, required to fetch sort data.
  *
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\SortClause $sortClause
  * @param int $number
  * @param array $languageSettings
  */
 public function applyJoin(SelectQuery $query, SortClause $sortClause, $number, array $languageSettings)
 {
     /** @var \eZ\Publish\API\Repository\Values\Content\Query\SortClause\Target\FieldTarget $fieldTarget */
     $fieldTarget = $sortClause->targetData;
     $fieldMap = $this->contentTypeHandler->getSearchableFieldMap();
     if (!isset($fieldMap[$fieldTarget->typeIdentifier][$fieldTarget->fieldIdentifier]['field_definition_id'])) {
         throw new InvalidArgumentException('$sortClause->targetData', 'No searchable fields found for the given sort clause target ' . "'{$fieldTarget->fieldIdentifier}' on '{$fieldTarget->typeIdentifier}'.");
     }
     $fieldDefinitionId = $fieldMap[$fieldTarget->typeIdentifier][$fieldTarget->fieldIdentifier]['field_definition_id'];
     $table = $this->getSortTableName($number);
     $externalTable = $this->getSortTableName($number, 'ezgmaplocation');
     $query->leftJoin($query->alias($this->dbHandler->quoteTable('ezcontentobject_attribute'), $this->dbHandler->quoteIdentifier($table)), $query->expr->lAnd($query->expr->eq($query->bindValue($fieldDefinitionId, null, PDO::PARAM_INT), $this->dbHandler->quoteColumn('contentclassattribute_id', $table)), $query->expr->eq($this->dbHandler->quoteColumn('contentobject_id', $table), $this->dbHandler->quoteColumn('id', 'ezcontentobject')), $query->expr->eq($this->dbHandler->quoteColumn('version', $table), $this->dbHandler->quoteColumn('current_version', 'ezcontentobject')), $this->getFieldCondition($query, $languageSettings, $table)))->leftJoin($query->alias($this->dbHandler->quoteTable('ezgmaplocation'), $this->dbHandler->quoteIdentifier($externalTable)), $query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn('contentobject_version', $externalTable), $this->dbHandler->quoteColumn('version', $table)), $query->expr->eq($this->dbHandler->quoteColumn('contentobject_attribute_id', $externalTable), $this->dbHandler->quoteColumn('id', $table))));
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:21,代码来源:MapLocationDistance.php

示例14: applyJoin

 /**
  * Applies joins to the query, required to fetch sort data
  *
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\SortClause $sortClause
  * @param int $number
  *
  * @return void
  */
 public function applyJoin(SelectQuery $query, SortClause $sortClause, $number)
 {
     /** @var \eZ\Publish\API\Repository\Values\Content\Query\SortClause\Target\FieldTarget $fieldTarget */
     $fieldTarget = $sortClause->targetData;
     $table = $this->getSortTableName($number);
     if ($fieldTarget->languageCode === null) {
         $linkTable = $table;
         $query->innerJoin($query->alias($this->dbHandler->quoteTable("ezcontentobject_attribute"), $this->dbHandler->quoteIdentifier($table)), $query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn("contentobject_id", $table), $this->dbHandler->quoteColumn("id", "ezcontentobject")), $query->expr->eq($this->dbHandler->quoteColumn("version", $table), $this->dbHandler->quoteColumn("current_version", "ezcontentobject")), $query->expr->gt($query->expr->bitAnd($query->expr->bitAnd($this->dbHandler->quoteColumn("language_id", $table), ~1), $this->dbHandler->quoteColumn("initial_language_id", "ezcontentobject")), 0)));
     } else {
         $linkTable = $table . "_main_language";
         $query->innerJoin($query->alias($this->dbHandler->quoteTable("ezcontentobject_attribute"), $this->dbHandler->quoteIdentifier($linkTable)), $query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn("contentobject_id", $linkTable), $this->dbHandler->quoteColumn("id", "ezcontentobject")), $query->expr->eq($this->dbHandler->quoteColumn("version", $linkTable), $this->dbHandler->quoteColumn("current_version", "ezcontentobject")), $query->expr->gt($query->expr->bitAnd($query->expr->bitAnd($this->dbHandler->quoteColumn("language_id", $linkTable), ~1), $this->dbHandler->quoteColumn("initial_language_id", "ezcontentobject")), 0)))->leftJoin($query->alias($this->dbHandler->quoteTable("ezcontentobject_attribute"), $this->dbHandler->quoteIdentifier($table)), $query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn("contentobject_id", $linkTable), $this->dbHandler->quoteColumn("contentobject_id", $table)), $query->expr->eq($this->dbHandler->quoteColumn("contentclassattribute_id", $linkTable), $this->dbHandler->quoteColumn("contentclassattribute_id", $table)), $query->expr->eq($this->dbHandler->quoteColumn("version", $linkTable), $this->dbHandler->quoteColumn("version", $table)), $query->expr->gt($query->expr->bitAnd($query->expr->bitAnd($this->dbHandler->quoteColumn("language_id", $table), ~1), $query->bindValue($this->languageHandler->loadByLanguageCode($fieldTarget->languageCode)->id, null, \PDO::PARAM_INT)), 0)));
     }
     $query->innerJoin($query->alias($this->dbHandler->quoteTable("ezcontentclass_attribute"), $this->dbHandler->quoteIdentifier("cc_attr_{$number}")), $query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn("contentclassattribute_id", $linkTable), $this->dbHandler->quoteColumn("id", "cc_attr_{$number}")), $query->expr->eq($this->dbHandler->quoteColumn("identifier", "cc_attr_{$number}"), $query->bindValue($fieldTarget->fieldIdentifier)), $query->expr->eq($this->dbHandler->quoteColumn("version", "cc_attr_{$number}"), $query->bindValue(Type::STATUS_DEFINED, null, \PDO::PARAM_INT))))->innerJoin($query->alias($this->dbHandler->quoteTable("ezcontentclass"), $this->dbHandler->quoteIdentifier("cc_{$number}")), $query->expr->lAnd($query->expr->eq($this->dbHandler->quoteColumn("contentclass_id", "cc_attr_{$number}"), $this->dbHandler->quoteColumn("id", "cc_{$number}")), $query->expr->eq($this->dbHandler->quoteColumn("identifier", "cc_{$number}"), $query->bindValue($fieldTarget->typeIdentifier)), $query->expr->eq($this->dbHandler->quoteColumn("version", "cc_{$number}"), $query->bindValue(Type::STATUS_DEFINED, null, \PDO::PARAM_INT))));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:23,代码来源:Field.php

示例15: handle

 /**
  * Generate query expression for a Criterion this handler accepts.
  *
  * accept() must be called before calling this method.
  *
  * @param \eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter $converter
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
  * @param array $languageSettings
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  */
 public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion, array $languageSettings)
 {
     switch ($criterion->target) {
         case Criterion\UserMetadata::MODIFIER:
             return $query->expr->in($this->dbHandler->quoteColumn('creator_id', 'ezcontentobject_version'), $criterion->value);
         case Criterion\UserMetadata::GROUP:
             $subSelect = $query->subSelect();
             $subSelect->select($this->dbHandler->quoteColumn('contentobject_id', 't1'))->from($query->alias($this->dbHandler->quoteTable('ezcontentobject_tree'), 't1'))->innerJoin($query->alias($this->dbHandler->quoteTable('ezcontentobject_tree'), 't2'), $query->expr->like('t1.path_string', $query->expr->concat('t2.path_string', $query->bindValue('%'))))->where($query->expr->in($this->dbHandler->quoteColumn('contentobject_id', 't2'), $criterion->value));
             return $query->expr->in($this->dbHandler->quoteColumn('owner_id', 'ezcontentobject'), $subSelect);
         case Criterion\UserMetadata::OWNER:
             return $query->expr->in($this->dbHandler->quoteColumn('owner_id', 'ezcontentobject'), $criterion->value);
     }
     throw new RuntimeException("Invalid target criterion encountered:'" . $criterion->target . "'");
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:26,代码来源:UserMetadata.php


注:本文中的eZ\Publish\Core\Persistence\Database\SelectQuery类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。