[4.x]: Why eagerloading automatically returns collection ? #11562
-
What happened?DescriptionI'm not sure if it makes sense to return collections for each eagerloading item automatically. I understand the relevance of being able to obtain collections via But I don't understand the reason to automate all this for eagerloader items. Wouldn't it be more convenient to return an array if If not, would it be feasible to configure via the config/general.php configuration file the expected return type for the eagerloading system. eg: Craft CMS version4.0.0 PHP versionNo response Operating system and versionNo response Database type and versionNo response Image driver and versionNo response Installed plugins and versions |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The entire motivation for adding support for collections was so there could be a consistent way of working with eager-loaded elements and normally-queried elements – see #8513.
Convenient how? You can do all the same things with a collection that you can with an array; you just get some added benefits on top of that. |
Beta Was this translation helpful? Give feedback.
The entire motivation for adding support for collections was so there could be a consistent way of working with eager-loaded elements and normally-queried elements – see #8513.
Convenient how? You can do all the same things with a collection that you can with an array; you just get some added benefits on top of that.