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
lukeholder
changed the title
[5.x]: PHP error when eager loading owner that is not the same element type as the nested element
[5.x]: PHP error when eager loading an element owner that is not the same element type as the nested element
Dec 17, 2024
What happened?
Description
The following code will cause the error:
This is due to
cms/src/base/NestedElementTrait.php
Line 42 in 92440e9
expecting that the element type for the eager loading of the parent is the same element type as the source element.
Adding a matrix field to a category element and using this query can also cause the error:
Since the category is not an entry element type.
Steps to reproduce
Add this code to a front-end template:
{% set addresses = craft.addresses.with(['owner']).all() %}
Actual behavior
PHP error
Related issue:
craftcms/commerce#3817
Fixed manually in Commerce with:
craftcms/commerce@5eacab1
Craft CMS version
5.x
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
No response
The text was updated successfully, but these errors were encountered: