FOF30\Model\DataModel::firstOrNew PHP Method

firstOrNew() public method

Return the first item found or create a new, blank one
public firstOrNew ( ) : static
return static
    public function firstOrNew()
    {
        $item = $this->get(true, 0, 1)->first();
        if (is_null($item)) {
            $item = clone $this;
            $item->reset();
        }
        return $item;
    }