You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure this is intended but the relations table doesn't seem to be cleaned up when removing a field from an entry type, and querying relatedTo elements does return results where it shouldn't.
If you have an entry type that contains let's say an asset field, and an entry with some value in it ($element in the following query). Then remove the field from the entry type. The query :
Relations are removed from the relations table in the following cases:
when the relation is removed via the field
when the field is deleted (not removed from the field layout, but deleted)
when the source of the relation is deleted
when the target of the relation is deleted
In the last 2 cases, Garbage Collection might be involved before the relations are deleted (because of the soft-delete feature).
We don’t, however, touch the relations when the field is removed from the layout. I don’t think we’d like to start doing this routinely, but we’ll discuss some options internally.
What happened?
Description
I'm not sure this is intended but the relations table doesn't seem to be cleaned up when removing a field from an entry type, and querying relatedTo elements does return results where it shouldn't.
If you have an entry type that contains let's say an asset field, and an entry with some value in it (
$element
in the following query). Then remove the field from the entry type. The query :still returns results.
I've resaved those entries, ran gc, but they're still in the
relations
table.Steps to reproduce
Expected behavior
That query doesn't return results
Craft CMS version
4.5.11
PHP version
8.2
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: