Skip to content
Snippets Groups Projects
Commit a7c60d66 authored by catch's avatar catch
Browse files

Issue #2895933 by boobaa, lendude, quietone, krzysztof domański, smustgrave,...

Issue #2895933 by boobaa, lendude, quietone, krzysztof domański, smustgrave, efpapado: EntityReverse will always use the 'standard' join plugin
parent a24f3ca3
No related branches found
No related tags found
No related merge requests found
Pipeline #450346 passed with warnings
Pipeline: drupal

#450357

    Pipeline: drupal

    #450353

      Pipeline: drupal

      #450349

        ......@@ -64,6 +64,7 @@ public function query() {
        // field, using the base table's id field to the field's column.
        $views_data = Views::viewsData()->get($this->table);
        $left_field = $views_data['table']['base']['field'];
        $id = !empty($this->definition['join_id']) ? $this->definition['join_id'] : 'standard';
        $first = [
        'left_table' => $this->tableAlias,
        ......@@ -98,7 +99,7 @@ public function query() {
        $second['type'] = 'INNER';
        }
        $second_join = $this->joinManager->createInstance('standard', $second);
        $second_join = $this->joinManager->createInstance($id, $second);
        $second_join->adjusted = TRUE;
        // Use a short alias for this:
        ......
        <?php
        declare(strict_types=1);
        namespace Drupal\Tests\views\Kernel\Plugin;
        use Drupal\views\Views;
        use Drupal\views_test_data\Plugin\views\join\JoinTest;
        /**
        * Tests the EntityReverse join plugin.
        *
        * @group views
        * @see \Drupal\views\Plugin\views\relationship\EntityReverse
        */
        class EntityReverseJoinTest extends RelationshipJoinTestBase {
        /**
        * {@inheritdoc}
        */
        public static $testViews = ['test_view'];
        /**
        * Tests that the EntityReverse plugin loads the correct join plugin.
        */
        public function testJoinThroughRelationship(): void {
        $relationship_manager = $this->container->get('plugin.manager.views.relationship');
        // Setup a simple join and test the result sql.
        $view = Views::getView('test_view');
        $view->initDisplay();
        $view->initQuery();
        $configuration = [
        'id' => 'entity_reverse',
        'base' => 'users_field_data',
        'table' => 'users_field_data',
        'field table' => 'users_field_data',
        'field field' => 'uid',
        'base field' => 'uid',
        'field_name' => 'uid',
        'join_id' => 'join_test',
        ];
        $relationship = $relationship_manager->createInstance('entity_reverse', $configuration);
        $relationship->tableAlias = 'users_field_data';
        $relationship->table = 'users_field_data';
        $relationship->query = $view->getQuery();
        $relationship->query();
        $this->assertInstanceOf(JoinTest::class, $relationship->query->getTableQueue()[$relationship->alias]['join']);
        }
        }
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment