本文整理汇总了PHP中SelectQuery::condition方法的典型用法代码示例。如果您正苦于以下问题:PHP SelectQuery::condition方法的具体用法?PHP SelectQuery::condition怎么用?PHP SelectQuery::condition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SelectQuery
的用法示例。
在下文中一共展示了SelectQuery::condition方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hook_query_rules_autotag_terms_alter
/**
* Alter the term DB query.
*
* @param SelectQuery $query
* The query object ot alter.
*/
function hook_query_rules_autotag_terms_alter($query)
{
// Join the original term query from rules_autotag with our field table to
// exclude terms that should not be tagged.
$query->leftJoin('field_data_field_dont_autotag', 'fd', "t.tid = fd.entity_id AND fd.entity_type = 'taxonomy_term'");
$query->condition(db_or()->condition('fd.field_dont_autotag_value', NULL)->condition('fd.field_dont_autotag_value', '1', '<>'));
}
示例2: queryForListFilter
/**
* Filter the query for list.
*
* @param \SelectQuery $query
* The query object.
*
* @throws BadRequestException
*
* @see \RestfulEntityBase::getQueryForList
*/
protected function queryForListFilter(\SelectQuery $query)
{
foreach ($this->parseRequestForListFilter() as $filter) {
/* @var ResourceFieldDbColumnInterface $filter_field */
if (!($filter_field = $this->fieldDefinitions->get($filter['public_field']))) {
continue;
}
$column_name = $filter_field->getColumnForQuery();
if (in_array(strtoupper($filter['operator'][0]), array('IN', 'NOT IN', 'BETWEEN'))) {
$query->condition($column_name, $filter['value'], $filter['operator'][0]);
continue;
}
$condition = db_condition($filter['conjunction']);
for ($index = 0; $index < count($filter['value']); $index++) {
$condition->condition($column_name, $filter['value'][$index], $filter['operator'][$index]);
}
$query->condition($condition);
}
}
示例3: condition
public function condition($field, $value = null, $operator = null)
{
Internal\condition_hook($field, $value, $operator);
return parent::condition($field, $value, $operator);
}
示例4: queryForListFilter
/**
* Filter the query for list.
*
* @param \SelectQuery $query
* The query object.
*
* @throws \RestfulBadRequestException
*
* @see \RestfulEntityBase::getQueryForList
*/
protected function queryForListFilter(\SelectQuery $query) {
$public_fields = $this->getPublicFields();
foreach ($this->parseRequestForListFilter() as $filter) {
if (in_array(strtoupper($filter['operator'][0]), array('IN', 'BETWEEN'))) {
$column_name = $this->getPropertyColumnForQuery($public_fields[$filter['public_field']]);
$query->condition($column_name, $filter['value'], $filter['operator'][0]);
continue;
}
$condition = db_condition($filter['conjunction']);
for ($index = 0; $index < count($filter['value']); $index++) {
$column_name = $this->getPropertyColumnForQuery($public_fields[$filter['public_field']]);
$condition->condition($column_name, $filter['value'][$index], $filter['operator'][$index]);
}
$query->condition($condition);
}
}
示例5: condition
/**
* @param string $field
* @param string|array $value
* @param string $operator
*
* @return $this
*/
public function condition($field, $value = null, $operator = null)
{
$this->query->condition($field, $value, $operator);
return $this;
}
示例6: setCondition
public function setCondition($column, $value)
{
$this->selectQuery->condition($column, $value);
}
示例7: hook_node_limit_sql
/**
* Improve node limit count request.
*
* Called when counting nodes to know if a limit has been reached.
*
* @param int $lid
* The node limit id
* @param SelectQuery $select
* The SQL select query
*/
function hook_node_limit_sql($lid, $select)
{
$limit = submodule_node_limit_load($lid);
if (empty($limit)) {
return;
}
$select->condition('uid', $limit['submodule']['uid']);
}