當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。