本文整理汇总了PHP中eZ\Publish\Core\Persistence\Database\SelectQuery::select方法的典型用法代码示例。如果您正苦于以下问题:PHP SelectQuery::select方法的具体用法?PHP SelectQuery::select怎么用?PHP SelectQuery::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZ\Publish\Core\Persistence\Database\SelectQuery
的用法示例。
在下文中一共展示了SelectQuery::select方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applySelect
/**
* Apply selects to the query.
*
* Returns the name of the (aliased) column, which information should be
* used for sorting.
*
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
* @param \eZ\Publish\API\Repository\Values\Content\Query\SortClause $sortClause
* @param int $number
*
* @return string
*/
public function applySelect(SelectQuery $query, SortClause $sortClause, $number)
{
/** @var \eZ\Publish\API\Repository\Values\Content\Query\SortClause\Target\MapLocationTarget $target */
$target = $sortClause->targetData;
$externalTable = $this->getSortTableName($number, 'ezgmaplocation');
/*
* Note: this formula is precise only for short distances.
*/
$longitudeCorrectionByLatitude = pow(cos(deg2rad($target->latitude)), 2);
$distanceExpression = $query->expr->add($query->expr->mul($query->expr->sub($this->dbHandler->quoteColumn('latitude', $externalTable), $query->bindValue($target->latitude)), $query->expr->sub($this->dbHandler->quoteColumn('latitude', $externalTable), $query->bindValue($target->latitude))), $query->expr->mul($query->expr->sub($this->dbHandler->quoteColumn('longitude', $externalTable), $query->bindValue($target->longitude)), $query->expr->sub($this->dbHandler->quoteColumn('longitude', $externalTable), $query->bindValue($target->longitude)), $query->bindValue($longitudeCorrectionByLatitude)));
$query->select($query->alias($distanceExpression, $column1 = $this->getSortColumnName($number)));
return array($column1);
}
示例2: applySelect
/**
* Apply selects to the query
*
* Returns the name of the (aliased) column, which information should be
* used for sorting.
*
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
* @param \eZ\Publish\API\Repository\Values\Content\Query\SortClause $sortClause
* @param int $number
*
* @return string
*/
public function applySelect(SelectQuery $query, SortClause $sortClause, $number)
{
$query->select($query->alias($this->dbHandler->quoteColumn('node_id', 'ezcontentobject_tree'), $column = $this->getSortColumnName($number)));
return $column;
}
示例3: selectColumns
/**
* Creates an array of select columns for $tableName.
*
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $q
* @param string $tableName
*/
protected function selectColumns(SelectQuery $q, $tableName)
{
foreach ($this->columns[$tableName] as $col) {
$q->select($this->dbHandler->aliasedColumn($q, $col, $tableName));
}
}
示例4: applySelect
/**
* Apply selects to the query.
*
* Returns the name of the (aliased) column, which information should be
* used for sorting.
*
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
* @param \eZ\Publish\API\Repository\Values\Content\Query\SortClause $sortClause
* @param int $number
*
* @return string
*/
public function applySelect(SelectQuery $query, SortClause $sortClause, $number)
{
$query->select($query->alias($query->expr->not($query->expr->isNull($this->dbHandler->quoteColumn('sort_key_int', $this->getSortTableName($number)))), $column1 = $this->getSortColumnName($number . '_null')), $query->alias($query->expr->not($query->expr->isNull($this->dbHandler->quoteColumn('sort_key_string', $this->getSortTableName($number)))), $column2 = $this->getSortColumnName($number . '_bis_null')), $query->alias($this->dbHandler->quoteColumn('sort_key_int', $this->getSortTableName($number)), $column3 = $this->getSortColumnName($number)), $query->alias($this->dbHandler->quoteColumn('sort_key_string', $this->getSortTableName($number)), $column4 = $this->getSortColumnName($number . '_bis')));
return array($column1, $column2, $column3, $column4);
}
示例5: applySelect
/**
* Apply selects to the query
*
* Returns the name of the (aliased) column, which information should be
* used for sorting.
*
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
* @param \eZ\Publish\API\Repository\Values\Content\Query\SortClause $sortClause
* @param int $number
*
* @return string
*/
public function applySelect(SelectQuery $query, SortClause $sortClause, $number)
{
$query->select($query->alias($this->dbHandler->quoteColumn("sort_key_int", $this->getSortTableName($number)), $column1 = $this->getSortColumnName($number)), $query->alias($this->dbHandler->quoteColumn("sort_key_string", $this->getSortTableName($number)), $column2 = $this->getSortColumnName($number . "_bis")));
return array($column1, $column2);
}
示例6: applySelect
/**
* Apply selects to the query
*
* Returns the name of the (aliased) column, which information should be
* used for sorting.
*
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
* @param \eZ\Publish\API\Repository\Values\Content\Query\SortClause $sortClause
* @param int $number
*
* @return string
*/
public function applySelect(SelectQuery $query, SortClause $sortClause, $number)
{
$query->select($query->alias($this->dbHandler->quoteColumn("name", $this->getSortTableName($number)), $column = $this->getSortColumnName($number)));
return $column;
}
示例7: setContentObjectWordsSelectQuery
/**
* Set query selecting word ids for content object (method was extracted to be reusable).
*
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
*/
private function setContentObjectWordsSelectQuery(SelectQuery $query)
{
$query->select('word_id')->from($this->dbHandler->quoteTable('ezsearch_object_word_link'))->where($query->expr->eq($this->dbHandler->quoteColumn('contentobject_id'), ':contentId'));
}
示例8: initSelectQuery
/**
* Initializes main selection $query.
*
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
*/
protected function initSelectQuery(SelectQuery $query)
{
/** @var \eZ\Publish\Core\Persistence\Database\DatabaseHandler $databaseHandler */
$databaseHandler = $this->getContainer()->get('ezpublish.connection');
$query->select($databaseHandler->quoteColumn('id', 'ezcontentobject'), $databaseHandler->quoteColumn('current_version', 'ezcontentobject'), $databaseHandler->quoteColumn('initial_language_id', 'ezcontentobject'), $query->expr->count('distinct ezcontentobject_attribute.language_code'))->from('ezcontentobject')->innerJoin($databaseHandler->quoteTable('ezcontentobject_attribute'), $query->expr->lAnd($query->expr->eq($databaseHandler->quoteColumn('id', 'ezcontentobject'), $databaseHandler->quoteColumn('contentobject_id', 'ezcontentobject_attribute')), $query->expr->eq($databaseHandler->quoteColumn('current_version', 'ezcontentobject'), $databaseHandler->quoteColumn('version', 'ezcontentobject_attribute')), $query->expr->gt($query->expr->bitAnd($databaseHandler->quoteColumn('language_id', 'ezcontentobject_attribute'), $query->bindValue(1, null, PDO::PARAM_INT)), $query->bindValue(0, null, PDO::PARAM_INT))))->where($query->expr->lAnd($query->expr->gt($query->expr->bitAnd($databaseHandler->quoteColumn('language_mask', 'ezcontentobject'), $query->bindValue(1, null, PDO::PARAM_INT)), $query->bindValue(0, null, PDO::PARAM_INT)), $query->expr->neq($query->expr->bitAnd($query->expr->bitAnd($databaseHandler->quoteColumn('language_mask', 'ezcontentobject'), $query->bindValue(-2, null, PDO::PARAM_INT)), $query->expr->sub($query->expr->bitAnd($databaseHandler->quoteColumn('language_mask', 'ezcontentobject'), $query->bindValue(-2, null, PDO::PARAM_INT)), $query->bindValue(1, null, PDO::PARAM_INT))), $query->bindValue(0, null, PDO::PARAM_INT))))->groupBy($databaseHandler->quoteColumn('id', 'ezcontentobject'))->having($query->expr->gt($query->expr->count('distinct ezcontentobject_attribute.language_code'), $query->bindValue(1, null, PDO::PARAM_INT)));
}
示例9: setFetchColumns
/**
* Set columns to be fetched from the database
*
* This method is intended to be overwritten by derived classes in order to
* add additional columns to be fetched from the database. Please do not
* forget to call the parent when overwriting this method.
*
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $selectQuery
* @param int $fieldId
* @param int $versionNo
*
* @return void
*/
protected function setFetchColumns(SelectQuery $selectQuery, $fieldId, $versionNo)
{
$connection = $this->getConnection();
$selectQuery->select($connection->quoteColumn('filename'), $connection->quoteColumn('mime_type'), $connection->quoteColumn('original_filename'));
}