Relationship query 'where' statements

Created on 22 January 2021, over 4 years ago
Updated 23 June 2025, 3 months ago

I still insist to use my logic of the query. See the parent issue for details.

Also, I faced another error
Column not found: 1054 Unknown column 'node_field_data.bundle' in 'where clause': SELECT

The code

    // Filter by entity bundles selected while configuring the relationship.
    if (!empty(array_filter($this->options['bundles']))) {
      $this->query->addWhere('recently_read', "$basetable.bundle", array_filter(array_values($this->options['bundles'])), "IN");
    }

was replaced by

    // Filter by entity bundles selected while configuring the relationship.
    if (!empty(array_filter($this->options['bundles']))) {
      $entity_type = $this->entityTypeManager->getDefinition($this->definition['entity_type']);
      $bundle_key = $entity_type->getKey('bundle');
      $this->query->addWhere('recently_read', "{$basetable}.{$bundle_key}", array_filter(array_values($this->options['bundles'])), 'IN');
    }
πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine nikita_tt

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024