Part of meta-issue #2002650: [meta, no patch] improve maintainability by removing unused local variables

File /core/modules/views/lib/Drupal/views/Plugin/views/relationship/GroupwiseMax.php

Line 222: Unused local variable $base_field

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

legolasbo’s picture

Assigned: legolasbo » Unassigned
Status: Active » Needs review
FileSize
735 bytes

Removed unused variable

phiit’s picture

Status: Needs review » Needs work

Reviewed, this patch fixes unused variable $base_field but after cleanup leaves another unused variable $views_data which was used only in $base_field.

@@ -219,7 +219,6 @@ protected function leftQuery($options) {
 
     // Add the base table ID field.
     $views_data = Views::viewsData()->get($this->definition['base']);
-    $base_field = $views_data['table']['base']['field'];
legolasbo’s picture

Status: Needs work » Needs review
FileSize
779 bytes

Attached patch also removes $views-data.

Anonymous’s picture

The patch in #3 still applies OK however I am unsure as to whether $base_field should actually be used or not. Here's the code:

    // Add the base table ID field.
    $views_data = Views::viewsData()->get($this->definition['base']);
    $base_field = $views_data['table']['base']['field'];
    $temp_view->addItem('default', 'field', $this->definition['base'], $this->definition['field']);

...perhaps in this line somewhere:

    $temp_view->addItem('default', 'field', $this->definition['base'], $this->definition['field']);

If not then the patch is good to go as far as I can see.

boran’s picture

Component: other » views.module
Status: Needs review » Reviewed & tested by the community

#3 is fine:
- makes sense
- patch applies cleanly
- Comment #4: $base_field is not used, although the words base and field do appear :-)
- views continues working

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed a34cb25 and pushed to 8.x. Thanks!

Committed as part of a merged commit for #2002650: [meta, no patch] improve maintainability by removing unused local variables

Automatically closed -- issue fixed for 2 weeks with no activity.