Isswp101\Persimmon\Model::findOrNew PHP Méthode

findOrNew() public static méthode

Find a model by its primary key or return new model.
public static findOrNew ( mixed $id ) : static
$id mixed
Résultat static
    public static function findOrNew($id)
    {
        $model = static::find($id);
        if (is_null($model)) {
            $model = static::createInstance();
            $model->setId($id);
        }
        return $model;
    }