本文整理汇总了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);
}
示例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))));
}
示例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);
}
示例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.");
}
}
示例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));
}
示例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))));
}
示例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')));
}