I've defined some logic in the _afterLoad()
for one of my models. When loading one model using Mage::getModel('foo/bar)->load(1)
_afterLoad()
is triggered and the extra data values are set. When loading a collection, though, _afterLoad
is not triggered on every model. How can I make it work that a collection returns its models with _afterLoad()
automatically executed?
Add a comment
|
1 Answer
The _afterLoad
method in the models is not meant to be loaded when the collection is loaded.
But there is an _afterLoad
method available for db collections also.
You can use that to implement your logic for a collection load.
-
That's lame ;p So in the collection _afterLoad() method you would loop over the loaded models and then you would call the public function afterLoad() on all of these models, right? Commented Aug 26, 2016 at 10:21