Model with Entity (return type) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Model with Entity (return type) (/showthread.php?tid=82383) |
Model with Entity (return type) - ozornick - 07-05-2022 Hello. The model returns a stdClass for the returnType. I would like to have a hint as User class. Is it really possible to do this? PHP Code: protected $returnType = \App\Models\Entity\User::class; RE: Model with Entity (return type) - iRedds - 07-05-2022 ->getFirstRow($this->returnType); instead of ->getRow(); RE: Model with Entity (return type) - ozornick - 07-05-2022 (07-05-2022, 07:58 AM)iRedds Wrote: ->getFirstRow($this->returnType); instead of ->getRow();Yes, I know that there is such a possibility. Thought I should automatically determine the entity. For find() findAll() only works. Thus, only the model knows about the class PHP Code: protected $returnType = \App\Models\Entity\Settings::class; |