From 0926b0cc7c2fdea9992fd26391b9a6ca1f309d6f Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Sat, 10 Jul 2021 09:58:37 +0100 Subject: [PATCH] Issue #3221933 by marcoscano, alexpott, owenbush: PHP Notice when using "left_formula" in views join --- core/modules/views/src/Plugin/views/join/JoinPluginBase.php | 6 +++++- core/modules/views/tests/src/Kernel/Plugin/JoinTest.php | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/modules/views/src/Plugin/views/join/JoinPluginBase.php b/core/modules/views/src/Plugin/views/join/JoinPluginBase.php index 6811dcddc78..e7741645686 100644 --- a/core/modules/views/src/Plugin/views/join/JoinPluginBase.php +++ b/core/modules/views/src/Plugin/views/join/JoinPluginBase.php @@ -266,7 +266,11 @@ class JoinPluginBase extends PluginBase implements JoinPluginInterface { } $this->leftTable = $configuration['left_table']; - $this->leftField = $configuration['left_field']; + + if (!empty($configuration['left_field'])) { + $this->leftField = $configuration['left_field']; + } + $this->field = $configuration['field']; if (!empty($configuration['left_formula'])) { diff --git a/core/modules/views/tests/src/Kernel/Plugin/JoinTest.php b/core/modules/views/tests/src/Kernel/Plugin/JoinTest.php index af7003f85e6..e06bc51371a 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/JoinTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/JoinTest.php @@ -205,6 +205,8 @@ class JoinTest extends RelationshipJoinTestBase { // Test that joins using 'left_formula' are properly built. $configuration['left_formula'] = 'MAX(views_test_data.uid)'; + // When 'left_formula' is present, 'left_field' is no longer required. + unset($configuration['left_field']); $join = $this->manager->createInstance('standard', $configuration); $table = ['alias' => 'users6']; $join->buildJoin($query, $table, $view->query);