Model->chunk() with Entities |
I was surprised to see that chunk (https://codeigniter4.github.io/CodeIgnit...ts-of-data) was returning on object of type stdClass instead of my model-defined return type (which happens to be an entity). A simple way to replicate:
PHP Code: $myModel = new MyModel(); First two objects from var_dump are App\Entities\MyEntity whereas the two from chunk() are stdClass. I traced the difference back to system/Model.php where findAll (line ~362) passes a parameter to getResult while chunk (line ~992) doesn't. I'm glad to open a pull request but I'm not sure if this is actually the intended/desired behavior? There's no documentation on chunk except for the user guide I linked above. EDIT - the two different functions from Model.php in case anyone is interested: PHP Code: public function findAll(int $limit = 0, int $offset = 0)
Yes, would definitely accept a PR for that as the expected behavior would be to return whatever the Model is currently set to return.
|
Welcome Guest, Not a member yet? Register Sign In |