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


PHP SelectQuery::leftJoin方法代码示例

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


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

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

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

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

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

示例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
  */
 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

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

示例7: 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::leftJoin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。