Fixed
Project:
Views Reference Filter
Version:
2.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Feb 2025 at 13:35 UTC
Updated:
6 Oct 2026 at 12:07 UTC
Jump to comment: Most recent
I would like to use the entity reference filter with the "is not one of" setup.
I receive an AJAX error on the views edit interface.
In the error log i see this message:
Error: Attempt to assign property "type" on null in Drupal\views\ManyToOneHelper->ensureMyTable() (line 254 of /.../web/core/modules/views/src/ManyToOneHelper.php).
The entity reference filter works correctly if the filter is "is one of".
I use Drupal 11.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
maximkashubaThanks for reporting this, and sorry for the late reply! I can confirm the bug. It still happens in the current 2.0.x.
Steps to reproduce
1. Create a Content view.
2. Add the filter "Content: ID (entityreference filter)" or "Authored by (entityreference filter)".
3. Set the operator to "Is none of" (or "Is all of").
4. Preview the view. It fails with Attempt to assign property "type" on null in ManyToOneHelper->ensureMyTable().
The same operators work fine on reference field columns (node__field_*).
Cause
The filter extends core's ManyToOne, which assumes the filtered column lives in a separate (multi-value) table that has to be joined. For the "Is none of" and "Is all of" operators, ManyToOneHelper::ensureMyTable() always gets that join and sets its type.
When the column is on the view's base table (entity id columns like nid, or base fields like uid), there is no join:
getJoin() returns NULL and the query build fails. "Is one of" works only because core has a NULL check for that case.
I'm moving this to a bug report against 2.0.x-dev. A fix with test coverage will follow.
Comment #7
maximkashubaFixed in MR !31 and released in 2.0.0-beta9.
"Is none of" and "Is all of" now work when the filter is on an entity ID
column (base table or via a relationship). Field columns keep the
existing ManyToOne behaviour. Kernel test coverage added for both cases.