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) |
Messages In This Thread |
Model->chunk() with Entities - by MGatner - 03-05-2019, 09:49 AM
RE: Model->chunk() with Entities - by kilishan - 03-05-2019, 02:41 PM
RE: Model->chunk() with Entities - by MGatner - 03-05-2019, 02:46 PM
RE: Model->chunk() with Entities - by kilishan - 03-05-2019, 03:07 PM
|