Welcome Guest, Not a member yet? Register   Sign In
Model with Entity (return type)
#3

(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;

    public function findLast(): ?Settings
    
{
        return $this->builder()
            ->orderBy('id DESC')
            ->get(1)->getCustomRowObject(0$this->returnType);
    
Simple CI 4 project for beginners codeigniter-expenses
Reply


Messages In This Thread
Model with Entity (return type) - by ozornick - 07-05-2022, 01:06 AM
RE: Model with Entity (return type) - by iRedds - 07-05-2022, 07:58 AM
RE: Model with Entity (return type) - by ozornick - 07-05-2022, 08:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB