Issue #2002340 by elvis2, jibran: Rename Views method add_where() to addWhere().

8.0.x
Alex Pott 2013-06-08 00:12:42 +01:00
parent 18e03273de
commit 167810ff96
24 changed files with 46 additions and 46 deletions

View File

@ -63,7 +63,7 @@ class UserUid extends ArgumentPluginBase {
->condition("$this->tableAlias.uid", $this->argument, '=')
->exists($subselect);
$this->query->add_where(0, $condition);
$this->query->addWhere(0, $condition);
}
/**

View File

@ -32,7 +32,7 @@ class UserUid extends FilterPluginBase {
->condition("$this->tableAlias.uid", $this->value, $this->operator)
->exists($subselect);
$this->query->add_where($this->options['group'], $condition);
$this->query->addWhere($this->options['group'], $condition);
}
}

View File

@ -147,12 +147,12 @@ class EntityReference extends DisplayPluginBase {
}
}
$this->view->query->add_where(0, $conditions);
$this->view->query->addWhere(0, $conditions);
}
// Add an IN condition for validation.
if (!empty($options['ids'])) {
$this->view->query->add_where(0, $id_field, $options['ids']);
$this->view->query->addWhere(0, $id_field, $options['ids']);
}
$this->view->setItemsPerPage($options['limit']);

View File

@ -41,8 +41,8 @@ class Access extends FilterPluginBase {
}
}
$this->query->add_where('AND', $grants);
$this->query->add_where('AND', $table . '.grant_view', 1, '>=');
$this->query->addWhere('AND', $grants);
$this->query->addWhere('AND', $table . '.grant_view', 1, '>=');
}
}

View File

@ -50,7 +50,7 @@ class Search extends ArgumentPluginBase {
}
if ($required) {
if ($this->operator == 'required') {
$this->query->add_where(0, 'FALSE');
$this->query->addWhere(0, 'FALSE');
}
}
else {
@ -102,7 +102,7 @@ class Search extends ArgumentPluginBase {
$search_condition->condition($or);
}
$this->query->add_where(0, $search_condition);
$this->query->addWhere(0, $search_condition);
$this->query->add_groupby("$search_index.sid");
$matches = $this->search_query->matches();
$placeholder = $this->placeholder();

View File

@ -130,7 +130,7 @@ class Search extends FilterPluginBase {
}
if ($required) {
if ($this->operator == 'required') {
$this->query->add_where($this->options['group'], 'FALSE');
$this->query->addWhere($this->options['group'], 'FALSE');
}
}
else {
@ -182,7 +182,7 @@ class Search extends FilterPluginBase {
$search_condition->condition($or);
}
$this->query->add_where($this->options['group'], $search_condition);
$this->query->addWhere($this->options['group'], $search_condition);
$this->query->add_groupby("$search_index.sid");
$matches = $this->search_query->matches();
$placeholder = $this->placeholder();

View File

@ -143,7 +143,7 @@ class IndexTidDepth extends ArgumentPluginBase {
}
$subquery->condition($where);
$this->query->add_where(0, "$this->tableAlias.$this->realField", $subquery, 'IN');
$this->query->addWhere(0, "$this->tableAlias.$this->realField", $subquery, 'IN');
}
function title() {

View File

@ -102,7 +102,7 @@ class TaxonomyIndexTidDepth extends TaxonomyIndexTid {
}
$subquery->condition($where);
$this->query->add_where($this->options['group'], "$this->tableAlias.$this->realField", $subquery, 'IN');
$this->query->addWhere($this->options['group'], "$this->tableAlias.$this->realField", $subquery, 'IN');
}
}

View File

@ -27,7 +27,7 @@ class UserUid extends CommentUserUid {
// table, we need to make sure {tracker_user} is JOINed and use its alias
// for the WHERE clause.
$tracker_user_alias = $this->query->ensure_table('tracker_user');
$this->query->add_where(0, "$tracker_user_alias.uid", $this->argument);
$this->query->addWhere(0, "$tracker_user_alias.uid", $this->argument);
}
}

View File

@ -27,7 +27,7 @@ class UserUid extends Name {
// table, we need to make sure {tracker_user} is JOINed and use its alias
// for the WHERE clause.
$tracker_user_alias = $this->query->ensure_table('tracker_user');
$this->query->add_where(0, "$tracker_user_alias.uid", $this->value);
$this->query->addWhere(0, "$tracker_user_alias.uid", $this->value);
}
}

View File

@ -45,7 +45,7 @@ class Current extends BooleanOperator {
else {
$or->condition($field, '***CURRENT_USER***', '=');
}
$this->query->add_where($this->options['group'], $or);
$this->query->addWhere($this->options['group'], $or);
}
}

View File

@ -325,7 +325,7 @@ class ManyToOneHelper {
}
// implode on either AND or OR.
$this->handler->query->add_where($options['group'], $clause);
$this->handler->query->addWhere($options['group'], $clause);
}
}

View File

@ -910,7 +910,7 @@ abstract class ArgumentPluginBase extends HandlerBase {
*/
public function query($group_by = FALSE) {
$this->ensureMyTable();
$this->query->add_where(0, "$this->tableAlias.$this->realField", $this->argument);
$this->query->addWhere(0, "$this->tableAlias.$this->realField", $this->argument);
}
/**

View File

@ -68,7 +68,7 @@ class Formula extends ArgumentPluginBase {
$placeholders = array(
$placeholder => $this->argument,
);
$this->query->add_where(0, $formula, $placeholders, 'formula');
$this->query->addWhere(0, $formula, $placeholders, 'formula');
}
}

View File

@ -115,7 +115,7 @@ class ManyToOne extends ArgumentPluginBase {
}
if ($empty) {
parent::ensureMyTable();
$this->query->add_where(0, "$this->tableAlias.$this->realField", NULL, 'IS NULL');
$this->query->addWhere(0, "$this->tableAlias.$this->realField", NULL, 'IS NULL');
return;
}

View File

@ -237,7 +237,7 @@ class String extends ArgumentPluginBase {
$this->query->add_where_expression(0, $field, $placeholders);
}
else {
$this->query->add_where(0, $field, $argument, $operator);
$this->query->addWhere(0, $field, $argument, $operator);
}
}

View File

@ -174,18 +174,18 @@ class BooleanOperator extends FilterPluginBase {
$or = db_or()
->condition($field, 0, '=')
->condition($field, NULL, 'IS NULL');
$this->query->add_where($this->options['group'], $or);
$this->query->addWhere($this->options['group'], $or);
}
else {
$this->query->add_where($this->options['group'], $field, 0, '=');
$this->query->addWhere($this->options['group'], $field, 0, '=');
}
}
else {
if (!empty($this->definition['use_equal'])) {
$this->query->add_where($this->options['group'], $field, 1, '=');
$this->query->addWhere($this->options['group'], $field, 1, '=');
}
else {
$this->query->add_where($this->options['group'], $field, 0, '<>');
$this->query->addWhere($this->options['group'], $field, 0, '<>');
}
}
}

View File

@ -37,7 +37,7 @@ class BooleanOperatorString extends BooleanOperator {
else {
$where .= "<> ''";
}
$this->query->add_where($this->options['group'], $where);
$this->query->addWhere($this->options['group'], $where);
}
}

View File

@ -1416,7 +1416,7 @@ abstract class FilterPluginBase extends HandlerBase {
*/
public function query() {
$this->ensureMyTable();
$this->query->add_where($this->options['group'], "$this->tableAlias.$this->realField", $this->value, $this->operator);
$this->query->addWhere($this->options['group'], "$this->tableAlias.$this->realField", $this->value, $this->operator);
}
/**

View File

@ -384,7 +384,7 @@ class InOperator extends FilterPluginBase {
// We use array_values() because the checkboxes keep keys and that can cause
// array addition problems.
$this->query->add_where($this->options['group'], "$this->tableAlias.$this->realField", array_values($this->value), $this->operator);
$this->query->addWhere($this->options['group'], "$this->tableAlias.$this->realField", array_values($this->value), $this->operator);
}
function op_empty() {
@ -396,7 +396,7 @@ class InOperator extends FilterPluginBase {
$operator = "IS NOT NULL";
}
$this->query->add_where($this->options['group'], "$this->tableAlias.$this->realField", NULL, $operator);
$this->query->addWhere($this->options['group'], "$this->tableAlias.$this->realField", NULL, $operator);
}
public function validate() {

View File

@ -253,15 +253,15 @@ class Numeric extends FilterPluginBase {
protected function opBetween($field) {
if ($this->operator == 'between') {
$this->query->add_where($this->options['group'], $field, array($this->value['min'], $this->value['max']), 'BETWEEN');
$this->query->addWhere($this->options['group'], $field, array($this->value['min'], $this->value['max']), 'BETWEEN');
}
else {
$this->query->add_where($this->options['group'], db_or()->condition($field, $this->value['min'], '<=')->condition($field, $this->value['max'], '>='));
$this->query->addWhere($this->options['group'], db_or()->condition($field, $this->value['min'], '<=')->condition($field, $this->value['max'], '>='));
}
}
protected function opSimple($field) {
$this->query->add_where($this->options['group'], $field, $this->value['value'], $this->operator);
$this->query->addWhere($this->options['group'], $field, $this->value['value'], $this->operator);
}
function op_empty($field) {
@ -272,11 +272,11 @@ class Numeric extends FilterPluginBase {
$operator = "IS NOT NULL";
}
$this->query->add_where($this->options['group'], $field, NULL, $operator);
$this->query->addWhere($this->options['group'], $field, NULL, $operator);
}
protected function opRegex($field) {
$this->query->add_where($this->options['group'], $field, $this->value, 'RLIKE');
$this->query->addWhere($this->options['group'], $field, $this->value, 'RLIKE');
}
public function adminSummary() {

View File

@ -261,11 +261,11 @@ class String extends FilterPluginBase {
}
public function opEqual($field) {
$this->query->add_where($this->options['group'], $field, $this->value, $this->operator());
$this->query->addWhere($this->options['group'], $field, $this->value, $this->operator());
}
protected function opContains($field) {
$this->query->add_where($this->options['group'], $field, '%' . db_like($this->value) . '%', 'LIKE');
$this->query->addWhere($this->options['group'], $field, '%' . db_like($this->value) . '%', 'LIKE');
}
protected function opContainsWord($field) {
@ -298,27 +298,27 @@ class String extends FilterPluginBase {
// previously this was a call_user_func_array but that's unnecessary
// as views will unpack an array that is a single arg.
$this->query->add_where($this->options['group'], $where);
$this->query->addWhere($this->options['group'], $where);
}
protected function opStartsWith($field) {
$this->query->add_where($this->options['group'], $field, db_like($this->value) . '%', 'LIKE');
$this->query->addWhere($this->options['group'], $field, db_like($this->value) . '%', 'LIKE');
}
protected function opNotStartsWith($field) {
$this->query->add_where($this->options['group'], $field, db_like($this->value) . '%', 'NOT LIKE');
$this->query->addWhere($this->options['group'], $field, db_like($this->value) . '%', 'NOT LIKE');
}
protected function opEndsWith($field) {
$this->query->add_where($this->options['group'], $field, '%' . db_like($this->value), 'LIKE');
$this->query->addWhere($this->options['group'], $field, '%' . db_like($this->value), 'LIKE');
}
protected function opNotEnds($field) {
$this->query->add_where($this->options['group'], $field, '%' . db_like($this->value), 'NOT LIKE');
$this->query->addWhere($this->options['group'], $field, '%' . db_like($this->value), 'NOT LIKE');
}
function op_not($field) {
$this->query->add_where($this->options['group'], $field, '%' . db_like($this->value) . '%', 'NOT LIKE');
$this->query->addWhere($this->options['group'], $field, '%' . db_like($this->value) . '%', 'NOT LIKE');
}
protected function opShorterThan($field) {
@ -332,7 +332,7 @@ class String extends FilterPluginBase {
}
protected function opRegex($field) {
$this->query->add_where($this->options['group'], $field, $this->value, 'RLIKE');
$this->query->addWhere($this->options['group'], $field, $this->value, 'RLIKE');
}
function op_empty($field) {
@ -343,7 +343,7 @@ class String extends FilterPluginBase {
$operator = "IS NOT NULL";
}
$this->query->add_where($this->options['group'], $field, NULL, $operator);
$this->query->addWhere($this->options['group'], $field, NULL, $operator);
}
}

View File

@ -823,7 +823,7 @@ class Sql extends QueryPluginBase {
* The $field, $value and $operator arguments can also be passed in with a
* single DatabaseCondition object, like this:
* @code
* $this->query->add_where(
* $this->query->addWhere(
* $this->options['group'],
* db_or()
* ->condition($field, $value, 'NOT IN')
@ -834,7 +834,7 @@ class Sql extends QueryPluginBase {
* @see Drupal\Core\Database\Query\ConditionInterface::condition()
* @see Drupal\Core\Database\Query\Condition
*/
function add_where($group, $field, $value = NULL, $operator = NULL) {
public function addWhere($group, $field, $value = NULL, $operator = NULL) {
// Ensure all variants of 0 are actually 0. Thus '', 0 and NULL are all
// the default group.
if (empty($group)) {

View File

@ -60,7 +60,7 @@ class QueryTest extends QueryPluginBase {
$this->allItems = $allItems;
}
public function add_where($group, $field, $value = NULL, $operator = NULL) {
public function addWhere($group, $field, $value = NULL, $operator = NULL) {
$this->conditions[] = array(
'field' => $field,
'value' => $value,