本文整理汇总了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))));
}