當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SelectQuery::innerJoin方法代碼示例

本文整理匯總了PHP中eZ\Publish\Core\Persistence\Database\SelectQuery::innerJoin方法的典型用法代碼示例。如果您正苦於以下問題:PHP SelectQuery::innerJoin方法的具體用法?PHP SelectQuery::innerJoin怎麽用?PHP SelectQuery::innerJoin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZ\Publish\Core\Persistence\Database\SelectQuery的用法示例。


在下文中一共展示了SelectQuery::innerJoin方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

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


注:本文中的eZ\Publish\Core\Persistence\Database\SelectQuery::innerJoin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。