- πΊπΈUnited States cecrs
Just leaving this here in case someone else runs into this for the same reason I did - I had a view with multiple exposed Term filters, and multiple relationships to the vocabularies. The Term filters were using the wrong relationship and that produced this error. I.e., view misconfiguration.
- Status changed to Active
about 1 year ago 8:05pm 24 September 2023 - π³π±Netherlands kingdutch
I'm running into this same issue. I've updated the issue summary according to the template and adding what I believe are the reproduction steps (but unfortunately getting this set-up in a fully clean install is more work than I have time for tonight, so I have a few changes in my custom set-up).
My custom entity definition and field definition are listed below, in case I've missed part of the reproduction steps. My entity annotation is using the
entity
module's ViewsData provider, but I swapped the core one out and could still reproduce the issue (hence mentioning the core class in the IS).The entity annotation.
/** * Define transactions that occur. * * @ContentEntityType( * id = "bank_transaction", * label = @Translation("Transaction"), * label_collection = @Translation("Transactions"), * label_singular = @Translation("transaction"), * label_plural = @Translation("transactions"), * label_count = @PluralTranslation( * singular = "@count transaction", * plural = "@count transactions" * ), * handlers = { * "storage" = "Drupal\Core\Entity\Sql\SqlContentEntityStorage", * "storage_schema" = "Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema", * "permission_provider" = "Drupal\entity\EntityPermissionProvider", * "access" = "Drupal\entity\EntityAccessControlHandler", * "view_builder" = "Drupal\Core\Entity\EntityViewBuilder", * "views_data" = "Drupal\entity\EntityViewsData", * }, * admin_permission = "administer transactions", * base_table = "bank_transaction", * show_revision_ui = FALSE, * translatable = FALSE, * entity_keys = { * "id" = "tid", * "uuid" = "uuid", * }, * links = { * "canonical" = "/transactions/{account}", * "collection" = "/transactions", * }, * common_reference_target = TRUE, * ) */ class BankTransaction extends ContentEntityBase implements ContentEntityInterface {
The taxonomy field definition in
baseFieldDefinitions
$fields['category'] = BaseFieldDefinition::create("entity_reference") ->setLabel(t('Category')) ->setDescription(t('The category this belongs to (e.g. Car > Fuel).')) ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) ->setSetting('target_type', 'taxonomy_term') ->setSetting('handler', 'default:taxonomy_term') ->setSetting('handler_settings', [ 'target_bundles' => [ 'bank_transaction_category' => 'bank_transaction_category', ], ]);
The views filter definition YML:
tid: id: tid table: taxonomy_term_field_data field: tid relationship: category_target_id group_type: group admin_label: '' entity_type: taxonomy_term entity_field: tid plugin_id: taxonomy_index_tid operator: and value: { } group: 1 exposed: true expose: operator_id: tid_op label: Category description: '' use_operator: false operator: tid_op operator_limit_selection: false operator_list: { } identifier: category required: false remember: false multiple: true remember_roles: authenticated: authenticated anonymous: '0' reduce: false is_grouped: false group_info: label: '' description: '' identifier: '' optional: true widget: select multiple: false remember: false default_group: All default_group_multiple: { } group_items: { } reduce_duplicates: false vid: bank_transaction_category type: select hierarchy: true limit: true error_message: true
The relationship definition
category_target_id: id: category_target_id table: bank_transaction__category field: category_target_id relationship: none group_type: group admin_label: 'Taxonomy term' entity_type: bank_transaction entity_field: category plugin_id: standard required: false
- π³π±Netherlands kingdutch
This sounds a whole lot like #2642132: Error when using views contextual filters summary option on taxonomy term name β and #2642132-15: Error when using views contextual filters summary option on taxonomy term name β notes that the error is different depending on your PHP version and how it handles unexpected NULL types.
- π³π±Netherlands kingdutch
Apologies for the double posting, more searching found more results.
#2829178-27: Views Term ID has broken filters ("All of", "Is none of") and contextual filters "allow multiple" β mentions that there are specific filter configurations that cause problems and others that don't. Upon trying this locally I can say that for my local set-up "'Any of' work[s] but 'None of' and 'All of' do[es]n't work"
That issue also has more work towards a patch done. I'm not entirely sure we should close this as duplicate since the ways to reproduce seem dissimilar but I have a hunch that the root cause is the same, just showing up in different ways.