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


PHP SelectQuery::alias方法代码示例

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


在下文中一共展示了SelectQuery::alias方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 $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

示例2: 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
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  */
 public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion)
 {
     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:Jenkosama,项目名称:ezpublish-kernel,代码行数:25,代码来源:UserMetadata.php

示例3: 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

示例4: 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

示例5: 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

示例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 $fieldFilters
  *
  * @return \eZ\Publish\Core\Persistence\Database\Expression
  */
 public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion, array $fieldFilters)
 {
     $table = 'permission_subtree';
     $statements = array();
     foreach ($criterion->value as $pattern) {
         $statements[] = $query->expr->like($this->dbHandler->quoteColumn('path_string', $table), $query->bindValue($pattern . '%'));
     }
     // Check if ezcontentobject_tree was already joined, if it was there is no need to join
     // with it again - first join will be reused by all other PermissionSubtree criteria
     /** @var $query \eZ\Publish\Core\Persistence\Doctrine\SelectDoctrineQuery */
     if (!$query->permissionSubtreeJoinAdded) {
         $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')));
         // Set joined state to true
         $query->permissionSubtreeJoinAdded = true;
     }
     return $query->expr->lOr($statements);
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:29,代码来源:PermissionSubtree.php

示例7: 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)
 {
     $table = $this->getUniqueTableName();
     $column = $this->dbHandler->quoteColumn('depth', $table);
     $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')));
     switch ($criterion->operator) {
         case Criterion\Operator::IN:
             return $query->expr->in($column, $criterion->value);
         case Criterion\Operator::BETWEEN:
             return $query->expr->between($column, $query->bindValue($criterion->value[0]), $query->bindValue($criterion->value[1]));
         case Criterion\Operator::EQ:
         case Criterion\Operator::GT:
         case Criterion\Operator::GTE:
         case Criterion\Operator::LT:
         case Criterion\Operator::LTE:
             $operatorFunction = $this->comparatorMap[$criterion->operator];
             return $query->expr->{$operatorFunction}($column, $query->bindValue(reset($criterion->value)));
         default:
             throw new RuntimeException("Unknown operator '{$criterion->operator}' for Depth criterion handler.");
     }
 }
开发者ID:nlescure,项目名称:ezpublish-kernel,代码行数:33,代码来源:Depth.php

示例8: applySelect

 /**
  * Apply selects to the query
  *
  * Returns the name of the (aliased) column, which information should be
  * used for sorting.
  *
  * @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
  * @param \eZ\Publish\API\Repository\Values\Content\Query\SortClause $sortClause
  * @param int $number
  *
  * @return string
  */
 public function applySelect(SelectQuery $query, SortClause $sortClause, $number)
 {
     $query->select($query->alias($this->dbHandler->quoteColumn('node_id', 'ezcontentobject_tree'), $column = $this->getSortColumnName($number)));
     return $column;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:17,代码来源:Id.php

示例9: 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
  */
 public function applyJoin(SelectQuery $query, SortClause $sortClause, $number)
 {
     /** @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);
     if ($fieldTarget->languageCode === null) {
         $languageExpression = $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 {
         $languageExpression = $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->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')), $languageExpression));
 }
开发者ID:xcorp1986,项目名称:ezpublish-kernel,代码行数:24,代码来源:Field.php

示例10: 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 $fieldMap
  *
  * @return void
  */
 public function applyJoin(SelectQuery $query, SortClause $sortClause, $number, array $fieldMap)
 {
     /** @var \eZ\Publish\API\Repository\Values\Content\Query\SortClause\Target\FieldTarget $fieldTarget */
     $fieldTarget = $sortClause->targetData;
     $fieldDefinitionId = $fieldMap[$fieldTarget->typeIdentifier][$fieldTarget->fieldIdentifier];
     $table = $this->getSortTableName($number);
     $externalTable = $this->getSortTableName($number, "ezgmaplocation");
     if ($fieldTarget->languageCode === null) {
         $languageExpression = $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 {
         $languageExpression = $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->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")), $languageExpression))->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:Jenkosama,项目名称:ezpublish-kernel,代码行数:24,代码来源:MapLocationDistance.php

示例11: 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 $fieldMap
  *
  * @return void
  */
 public function applyJoin(SelectQuery $query, SortClause $sortClause, $number, array $fieldMap)
 {
     $table = $this->getSortTableName($number);
     $query->leftJoin($query->alias($this->dbHandler->quoteTable('ezsection'), $this->dbHandler->quoteIdentifier($table)), $query->expr->eq($this->dbHandler->quoteColumn('id', $table), $this->dbHandler->quoteColumn('section_id', 'ezcontentobject')));
 }
开发者ID:Jenkosama,项目名称:ezpublish-kernel,代码行数:15,代码来源:SectionName.php


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