From 18e03273de06d79eb47ae55f9eea26ffe5042088 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Sat, 8 Jun 2013 00:10:08 +0100 Subject: [PATCH] Issue #2002274 by elvis2: Rename Views method add_relationship() to addRelationship(). --- .../Drupal/comment/Plugin/views/field/NcsLastCommentName.php | 1 - .../lib/Drupal/comment/Plugin/views/sort/NcsLastCommentName.php | 1 - .../Drupal/field/Plugin/views/relationship/EntityReverse.php | 2 +- .../search/lib/Drupal/search/Plugin/views/argument/Search.php | 2 +- .../search/lib/Drupal/search/Plugin/views/filter/Search.php | 2 +- .../Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php | 2 +- core/modules/views/lib/Drupal/views/ManyToOneHelper.php | 2 +- core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php | 2 +- .../lib/Drupal/views/Plugin/views/relationship/GroupwiseMax.php | 2 +- .../views/Plugin/views/relationship/RelationshipPluginBase.php | 2 +- 10 files changed, 8 insertions(+), 10 deletions(-) diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastCommentName.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastCommentName.php index 6287811f6f0..e515c1de38a 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastCommentName.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NcsLastCommentName.php @@ -40,7 +40,6 @@ class NcsLastCommentName extends FieldPluginBase { $join = drupal_container()->get('plugin.manager.views.join')->createInstance('standard', $definition); // ncs_user alias so this can work with the sort handler, below. -// $this->user_table = $this->query->add_relationship(NULL, $join, 'users', $this->relationship); $this->user_table = $this->query->ensure_table('ncs_users', $this->relationship, $join); $this->field_alias = $this->query->add_field(NULL, "COALESCE($this->user_table.name, $this->tableAlias.$this->field)", $this->tableAlias . '_' . $this->field); diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/sort/NcsLastCommentName.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/sort/NcsLastCommentName.php index 9e2c70e49c5..78aa9bff719 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/sort/NcsLastCommentName.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/sort/NcsLastCommentName.php @@ -33,7 +33,6 @@ class NcsLastCommentName extends SortPluginBase { // @todo this might be safer if we had an ensure_relationship rather than guessing // the table alias. Though if we did that we'd be guessing the relationship name // so that doesn't matter that much. -// $this->user_table = $this->query->add_relationship(NULL, $join, 'users', $this->relationship); $this->user_table = $this->query->ensure_table('ncs_users', $this->relationship, $join); $this->user_field = $this->query->add_field($this->user_table, 'name'); diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/relationship/EntityReverse.php b/core/modules/field/lib/Drupal/field/Plugin/views/relationship/EntityReverse.php index 02ee8e97bcb..481105fd735 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/views/relationship/EntityReverse.php +++ b/core/modules/field/lib/Drupal/field/Plugin/views/relationship/EntityReverse.php @@ -93,7 +93,7 @@ class EntityReverse extends RelationshipPluginBase { // use a short alias for this: $alias = $this->definition['field_name'] . '_' . $this->table; - $this->alias = $this->query->add_relationship($alias, $second_join, $this->definition['base'], $this->relationship); + $this->alias = $this->query->addRelationship($alias, $second_join, $this->definition['base'], $this->relationship); } } diff --git a/core/modules/search/lib/Drupal/search/Plugin/views/argument/Search.php b/core/modules/search/lib/Drupal/search/Plugin/views/argument/Search.php index 6d73cbce7f1..14a26674361 100644 --- a/core/modules/search/lib/Drupal/search/Plugin/views/argument/Search.php +++ b/core/modules/search/lib/Drupal/search/Plugin/views/argument/Search.php @@ -66,7 +66,7 @@ class Search extends ArgumentPluginBase { 'left_field' => 'word', ); $join = drupal_container()->get('plugin.manager.views.join')->createInstance('standard', $definition); - $search_total = $this->query->add_relationship('search_total', $join, $search_index); + $search_total = $this->query->addRelationship('search_total', $join, $search_index); $this->search_score = $this->query->add_field('', "SUM($search_index.score * $search_total.count)", 'score', array('aggregate' => TRUE)); diff --git a/core/modules/search/lib/Drupal/search/Plugin/views/filter/Search.php b/core/modules/search/lib/Drupal/search/Plugin/views/filter/Search.php index fa4606644cf..da0c747d3eb 100644 --- a/core/modules/search/lib/Drupal/search/Plugin/views/filter/Search.php +++ b/core/modules/search/lib/Drupal/search/Plugin/views/filter/Search.php @@ -147,7 +147,7 @@ class Search extends FilterPluginBase { ); $join = drupal_container()->get('plugin.manager.views.join')->createInstance('standard', $definition); - $search_total = $this->query->add_relationship('search_total', $join, $search_index); + $search_total = $this->query->addRelationship('search_total', $join, $search_index); $this->search_score = $this->query->add_field('', "SUM($search_index.score * $search_total.count)", 'score', array('aggregate' => TRUE)); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php index dd526454715..cdb23a95e74 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php @@ -100,7 +100,7 @@ class NodeTermData extends RelationshipPluginBase { // use a short alias for this: $alias = $def['table'] . '_' . $this->table; - $this->alias = $this->query->add_relationship($alias, $join, 'taxonomy_term_data', $this->relationship); + $this->alias = $this->query->addRelationship($alias, $join, 'taxonomy_term_data', $this->relationship); } } diff --git a/core/modules/views/lib/Drupal/views/ManyToOneHelper.php b/core/modules/views/lib/Drupal/views/ManyToOneHelper.php index ed60500fac0..caca5914dff 100644 --- a/core/modules/views/lib/Drupal/views/ManyToOneHelper.php +++ b/core/modules/views/lib/Drupal/views/ManyToOneHelper.php @@ -93,7 +93,7 @@ class ManyToOneHelper { } // If we found that there are tables in between, add the relationship. if ($r_join->table != $join->table) { - $relationship = $this->handler->query->add_relationship($this->handler->table . '_' . $r_join->table, $r_join, $r_join->table, $this->handler->relationship); + $relationship = $this->handler->query->addRelationship($this->handler->table . '_' . $r_join->table, $r_join, $r_join->table, $this->handler->relationship); } // And now add our table, using the new relationship if one was used. diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php index 7555ff47f47..b5954b57019 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php @@ -290,7 +290,7 @@ class Sql extends QueryPluginBase { * might have a relationship to an 'album' node, which might * have a relationship to an 'artist' node. */ - function add_relationship($alias, JoinPluginBase $join, $base, $link_point = NULL) { + public function addRelationship($alias, JoinPluginBase $join, $base, $link_point = NULL) { if (empty($link_point)) { $link_point = $this->view->storage->get('base_table'); } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/relationship/GroupwiseMax.php b/core/modules/views/lib/Drupal/views/Plugin/views/relationship/GroupwiseMax.php index b685dedf69a..6f8f2f09c2f 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/relationship/GroupwiseMax.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/relationship/GroupwiseMax.php @@ -383,7 +383,7 @@ class GroupwiseMax extends RelationshipPluginBase { // use a short alias for this: $alias = $def['table'] . '_' . $this->table; - $this->alias = $this->query->add_relationship($alias, $join, $this->definition['base'], $this->relationship); + $this->alias = $this->query->addRelationship($alias, $join, $this->definition['base'], $this->relationship); } } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php index 89735a0c789..d2f56604470 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php @@ -135,7 +135,7 @@ abstract class RelationshipPluginBase extends HandlerBase { // use a short alias for this: $alias = $def['table'] . '_' . $this->table; - $this->alias = $this->query->add_relationship($alias, $join, $this->definition['base'], $this->relationship); + $this->alias = $this->query->addRelationship($alias, $join, $this->definition['base'], $this->relationship); // Add access tags if the base table provide it. if (empty($this->query->options['disable_sql_rewrite']) && isset($table_data['table']['base']['access query tag'])) {