Hello,
Can I somehow override the toArray() function in Phalcon\Mvc\Model\Resultset\Simple from within PHP?
I'm trying to extend it so that instead of returning it's _rows
array directly, it turns each of it's rows into a model instance (like what happens when you iterate the resultset) and calls toArray() on each row and returns those results.
This means that I can overwrite the toArray in my base model to 'enhance' certain fields, and automatically have all records returned in the Resultsets' toArray() function also be enhanced too.
This makes the Resultset returned by Model::find() function a lot more useful because I don't have to manually loop and toArray each row to get my enhanced result.
I'm not sure if overriding the function is even the best approach but I hope my intentions are clear.