Issue #2799479: Views doesn't recognize relationship to host
Merge request reports
Activity
- Resolved by Sascha Grossenbacher
added 8 commits
-
f6938e81...a5bd17b9 - 6 commits from branch
project:8.x-1.x
- 0774f225 - Issue #2799479 by Drews_man: Views doesn't recognize relationship to host
- 7607eace - Issue #2799479 by nikita_tt,ao5357: Views doesn't recognize relationship to host
-
f6938e81...a5bd17b9 - 6 commits from branch
added 2 commits
added 5 commits
Toggle commit listadded 9 commits
-
3dbf8d88...93c41a3b - 8 commits from branch
project:8.x-1.x
- 989cd98c - Merge branch '8.x-1.x' into 2799479-views-doesnt-recognize
-
3dbf8d88...93c41a3b - 8 commits from branch
added 10 commits
-
ad348fb8...19fca959 - 4 commits from branch
project:8.x-1.x
- 63c27f82 - Issue #2799479 by Drews_man: Views doesn't recognize relationship to host
- f52e3da6 - Issue #2799479 by nikita_tt,ao5357: Views doesn't recognize relationship to host
- 772c66f2 - Add missing filter plugin
- 8c1b5bde - Add missing tests
- 56cec0ea - Fix tests - attempt 1.
- 51b024f7 - Fix tests - attempt 2.
Toggle commit list-
ad348fb8...19fca959 - 4 commits from branch
added 8 commits
-
51b024f7...c808870a - 2 commits from branch
project:8.x-1.x
- 5fed1531 - Issue #2799479 by Drews_man: Views doesn't recognize relationship to host
- 847ffe75 - Issue #2799479 by nikita_tt,ao5357: Views doesn't recognize relationship to host
- 2aca998e - Add missing filter plugin
- 629ed914 - Add missing tests
- 6bef4ba5 - Fix tests - attempt 1.
- 1cd64979 - Fix tests - attempt 2.
Toggle commit list-
51b024f7...c808870a - 2 commits from branch
65 'left_table' => $this->tableAlias, 66 'left_field' => $left_field, 67 'table' => $this->definition['field table'], 68 'field' => $this->definition['field field'], 69 'adjusted' => TRUE, 70 ]; 71 if (!empty($this->options['required'])) { 72 $first['type'] = 'INNER'; 73 } 74 75 if (!empty($this->definition['join_extra'])) { 76 $first['extra'] = $this->definition['join_extra']; 77 } 78 79 if (!empty($def['join_id'])) { 80 $id = $def['join_id']; phpstan correctly points out that $def does not exist, so this doesn't work. Comparing with \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::query, that should probably look at $first instead. Also can be simplified to a $first['join_id'] ?? 'standard'; now.
same below with $second.
changed this line in version 10 of the diff
73 } 74 75 if (!empty($this->definition['join_extra'])) { 76 $first['extra'] = $this->definition['join_extra']; 77 } 78 79 if (!empty($def['join_id'])) { 80 $id = $def['join_id']; 81 } 82 else { 83 $id = 'standard'; 84 } 85 $first_join = $this->joinManager->createInstance($id, $first); 86 87 88 $this->first_alias = $this->query->addTable($this->definition['field table'], $this->relationship, $first_join); changed this line in version 10 of the diff
This was fixed in 6e180912.
Edited by Panagiotis Moutsopoulos
48 $table_mapping = $entity_type_manager->getStorage($entity_type_id) 49 ->getTableMapping(); 50 51 $entity_type = $entity_types[$entity_type_id]; 52 $base_table = $entity_type->getDataTable() ?: $entity_type->getBaseTable(); 53 54 /** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */ 55 foreach ($fields as $field) { 56 // Add a relationship to the target entity type. 57 $target_entity_type_id = $field->getSettings()['target_type']; 58 $target_entity_type = $entity_type_manager->getDefinition($target_entity_type_id); 59 $entity_type_id = $field->getTargetEntityTypeId(); 60 $entity_type = $entity_type_manager->getDefinition($entity_type_id); 61 $field_name = $field->getName(); 62 // Unlimited (-1) or > 1 store field data in a dedicated table. 63 $table = $field->getCardinality() == 1 ? $base_table : $entity_type->getBaseTable() . '__' . $field_name; field tables don't depend on the base table but the entity type. Aand there is logic with shortening too long table names, which isn't implemented here.
This should use \Drupal\Core\Entity\Sql\DefaultTableMapping::getFieldTableName() or getDedicatedDataTableName() instead. The other hook is using this, it should also work for base fields.
added 1 commit
- d68b42fc - Address review in relationship plugin, align with core EntityReverse plugin
added 1 commit
- 6e180912 - Change dynamic property 'first_alias' to regular PHP variable, to fix PHP8.3 deprecation warning
added 3 commits
-
6e180912...160384c2 - 2 commits from branch
project:8.x-1.x
- bd6922d6 - Merge branch entity_reference_revisions:8.x-1.x into 2799479-views-doesnt-recognize
-
6e180912...160384c2 - 2 commits from branch