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 :
Entry::find()->relatedTo(['targetElement' => $element])->all()
still returns results.
I've resaved those entries, ran gc, but they're still in the relations table.
Steps to reproduce
- Create an Asset field
- Add the field to an Entry type
- Create an entry of that type
- Remove the asset field from the entry type
- Run the query above
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
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 (
$elementin 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
relationstable.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