cms
cms copied to clipboard
[5.x]: Entry to Array convert ignores already eager loaded relationships
What happened?
Description
If an entry will be loaded with eager relationships (via with()), the array conversion should include the eager loaded content.
Steps to reproduce
- Create an EntryType with a matrix field with entry types containing relational fields (for example asset)
- Create a Entry with filled field
- In PHP - load this entry eager loaded with the with() function to and save that to a variable
- call $entry->toArray();
Expected behavior
The toArray conversion should contain the already loaded relationships.
Actual behavior
The converted array not resolving the eager loaded content. The $_eagerLoadedElements array is untouched on associative array conversion.
Craft CMS version
5.0.0-beta3
PHP version
8.3
Operating system and version
MacOs (ddev)
Database type and version
mysql 8.0
Image driver and version
No response
Installed plugins and versions
-
This is working as expected. toArray() should not be impacted by whether elements were eager-loaded.