Commit 6345a5cb authored by alexpott's avatar alexpott

Issue #2002484 by brennanmh, heddn, Dan Reinders, hussainweb: Rename Views...

Issue #2002484 by brennanmh, heddn, Dan Reinders, hussainweb: Rename Views method ensure_table() to ensureTable().
parent 5c093487
......@@ -40,7 +40,7 @@ public function query() {
$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->ensure_table('ncs_users', $this->relationship, $join);
$this->user_table = $this->query->ensureTable('ncs_users', $this->relationship, $join);
$this->field_alias = $this->query->addField(NULL, "COALESCE($this->user_table.name, $this->tableAlias.$this->field)", $this->tableAlias . '_' . $this->field);
......
......@@ -21,7 +21,7 @@ class NcsLastUpdated extends Date {
public function query() {
$this->ensureMyTable();
$this->node_table = $this->query->ensure_table('node', $this->relationship);
$this->node_table = $this->query->ensureTable('node', $this->relationship);
$this->field_alias = $this->query->addField(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->tableAlias . ".last_comment_timestamp)", $this->tableAlias . '_' . $this->field);
}
......
......@@ -21,7 +21,7 @@ class NcsLastUpdated extends Date {
public function query() {
$this->ensureMyTable();
$this->node_table = $this->query->ensure_table('node', $this->relationship);
$this->node_table = $this->query->ensureTable('node', $this->relationship);
$field = "GREATEST(" . $this->node_table . ".changed, " . $this->tableAlias . ".last_comment_timestamp)";
......
......@@ -33,7 +33,7 @@ public function query() {
// @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->ensure_table('ncs_users', $this->relationship, $join);
$this->user_table = $this->query->ensureTable('ncs_users', $this->relationship, $join);
$this->user_field = $this->query->addField($this->user_table, 'name');
// Add the field.
......
......@@ -21,7 +21,7 @@ class NcsLastUpdated extends Date {
public function query() {
$this->ensureMyTable();
$this->node_table = $this->query->ensure_table('node', $this->relationship);
$this->node_table = $this->query->ensureTable('node', $this->relationship);
$this->field_alias = $this->query->addOrderBy(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->tableAlias . ".last_comment_timestamp)", $this->options['order'], $this->tableAlias . '_' . $this->field);
}
......
......@@ -71,12 +71,12 @@ public function query() {
$this->ensureMyTable();
$field = "$this->tableAlias.$this->realField";
$node = $this->query->ensure_table('node_field_data', $this->relationship);
$node = $this->query->ensureTable('node_field_data', $this->relationship);
$clause = '';
$clause2 = '';
if (module_exists('comment')) {
$ncs = $this->query->ensure_table('node_comment_statistics', $this->relationship);
$ncs = $this->query->ensureTable('node_comment_statistics', $this->relationship);
$clause = ("OR $ncs.last_comment_timestamp > (***CURRENT_TIME*** - $limit)");
$clause2 = "OR $field < $ncs.last_comment_timestamp";
}
......
......@@ -26,7 +26,7 @@ public function query($group_by = FALSE) {
// Because this handler thinks it's an argument for a field on the {node}
// 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');
$tracker_user_alias = $this->query->ensureTable('tracker_user');
$this->query->addWhere(0, "$tracker_user_alias.uid", $this->argument);
}
......
......@@ -26,7 +26,7 @@ public function query() {
// Because this handler thinks it's an argument for a field on the {node}
// 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');
$tracker_user_alias = $this->query->ensureTable('tracker_user');
$this->query->addWhere(0, "$tracker_user_alias.uid", $this->value);
}
......
......@@ -133,7 +133,7 @@ function summary_join() {
}
if (empty($options['add_table']) || empty($view->many_to_one_tables[$field])) {
return $query->ensure_table($this->handler->table, $this->handler->relationship, $join);
return $query->ensureTable($this->handler->table, $this->handler->relationship, $join);
}
else {
if (!empty($view->many_to_one_tables[$field])) {
......@@ -169,7 +169,7 @@ public function ensureMyTable() {
if (isset($join)) {
$join->type = 'INNER';
}
$this->handler->tableAlias = $this->handler->query->ensure_table($this->handler->table, $this->handler->relationship, $join);
$this->handler->tableAlias = $this->handler->query->ensureTable($this->handler->table, $this->handler->relationship, $join);
$this->handler->view->many_to_one_tables[$field] = $this->handler->value;
}
else {
......
......@@ -527,7 +527,7 @@ public function setRelationship() {
*/
public function ensureMyTable() {
if (!isset($this->tableAlias)) {
$this->tableAlias = $this->query->ensure_table($this->table, $this->relationship);
$this->tableAlias = $this->query->ensureTable($this->table, $this->relationship);
}
return $this->tableAlias;
}
......
......@@ -832,7 +832,7 @@ protected function summaryNameField() {
}
}
else {
$this->name_table_alias = $this->query->ensure_table($this->name_table, $this->relationship);
$this->name_table_alias = $this->query->ensureTable($this->name_table, $this->relationship);
}
}
else {
......
......@@ -170,7 +170,7 @@ protected function summaryQuery() {
}
if (empty($this->options['add_table']) || empty($this->view->many_to_one_tables[$field])) {
$this->tableAlias = $this->query->ensure_table($this->table, $this->relationship, $join);
$this->tableAlias = $this->query->ensureTable($this->table, $this->relationship, $join);
}
else {
$this->tableAlias = $this->helper->summary_join();
......
......@@ -135,7 +135,7 @@ protected function addAdditionalFields($fields = NULL) {
foreach ($fields as $identifier => $info) {
if (is_array($info)) {
if (isset($info['table'])) {
$table_alias = $this->query->ensure_table($info['table'], $this->relationship);
$table_alias = $this->query->ensureTable($info['table'], $this->relationship);
}
else {
$table_alias = $this->tableAlias;
......
......@@ -365,7 +365,7 @@ public function addTable($table, $relationship = NULL, JoinPluginBase $join = NU
* Add a table to the query without ensuring the path.
*
* This is a pretty internal function to Views and addTable() or
* ensure_table() should be used instead of this one, unless you are
* ensureTable() should be used instead of this one, unless you are
* absolutely sure this is what you want.
*
* @param $table
......@@ -493,7 +493,7 @@ protected function markTable($table, $relationship, $alias) {
* The alias used to refer to this specific table, or NULL if the table
* cannot be ensured.
*/
function ensure_table($table, $relationship = NULL, JoinPluginBase $join = NULL) {
public function ensureTable($table, $relationship = NULL, JoinPluginBase $join = NULL) {
// ensure a relationship
if (empty($relationship)) {
$relationship = $this->view->storage->get('base_table');
......@@ -645,7 +645,7 @@ protected function adjustJoin($join, $relationship) {
if ($join->leftTable != $this->relationships[$relationship]['table'] &&
$join->leftTable != $this->relationships[$relationship]['base'] &&
!isset($this->tables[$relationship][$join->leftTable]['alias'])) {
$this->ensure_table($join->leftTable, $relationship);
$this->ensureTable($join->leftTable, $relationship);
}
// First, if this is our link point/anchor table, just use the relationship
......@@ -690,7 +690,7 @@ public function getJoinData($table, $base_table) {
* Get the information associated with a table.
*
* If you need the alias of a table with a particular relationship, use
* ensure_table().
* ensureTable().
*/
public function getTableInfo($table) {
if (!empty($this->table_queue[$table])) {
......@@ -708,12 +708,12 @@ public function getTableInfo($table) {
/**
* Add a field to the query table, possibly with an alias. This will
* automatically call ensure_table to make sure the required table
* automatically call ensureTable to make sure the required table
* exists, *unless* $table is unset.
*
* @param $table
* The table this field is attached to. If NULL, it is assumed this will
* be a formula; otherwise, ensure_table is used to make sure the
* be a formula; otherwise, ensureTable is used to make sure the
* table exists.
* @param $field
* The name of the field to add. This may be a real field or a formula.
......@@ -735,7 +735,7 @@ public function addField($table, $field, $alias = '', $params = array()) {
}
if ($table && empty($this->table_queue[$table])) {
$this->ensure_table($table);
$this->ensureTable($table);
}
if (!$alias && $table) {
......@@ -937,7 +937,7 @@ public function addOrderBy($table, $field = NULL, $order = 'ASC', $alias = '', $
// Only ensure the table if it's not the special random key.
// @todo: Maybe it would make sense to just add an addOrderByRand or something similar.
if ($table && $table != 'rand') {
$this->ensure_table($table);
$this->ensureTable($table);
}
// Only fill out this aliasing if there is a table;
......
......@@ -79,7 +79,7 @@ public function addOrderBy($table, $field = NULL, $order = 'ASC', $alias = '', $
}
public function ensure_table($table, $relationship = NULL, JoinPluginBase $join = NULL) {
public function ensureTable($table, $relationship = NULL, JoinPluginBase $join = NULL) {
// There is no concept of joins.
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment