Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294490

Standard relationship handler should be able to create relationships to tables in different databases

$
0
0

In hook_views_data it is possible to specify the database for the base table.

$data['my_table']['table']['base']['database'] = ...

However when defining a relationship using the default relationship handler only relationships to the same database as the base table are possible.

When trying to add the database as a prefix in the base item definition of the relationship, an error occurs, as when building the query an alias is used and aliases are not allowed to contain dots. In RelationshipPluginBase I tried to make a workaround by using:
$alias = str_replace('.', '_', $def['table']) . '_' . $this->table;
Now the query shown in views looks good, but no fields can be added from the joined table and there is some error in the log:
Undefined index: table in Drupal\views\Plugin\views\relationship\RelationshipPluginBase->calculateDependencies()

It would be great to have a possibility to specify something like 'base database' in the relationship handler to be able to join to different databases.

When defining a join however prefixing the database works fine. But also for the join it would be cleaner to be able to specify the database differently.


Viewing all articles
Browse latest Browse all 294490

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>