public function findOne(Repository $repository = null): Model
    {
        if (!$repository && !($repository = $this->repository)) {
            throw new \RuntimeException('The current Query object is not tied to any Repository');
        }

        return $repository->findOne($this->compileParameters());
    }
public function findOne(Repository $repository = null): Model
    {
        if (!$repository && !($repository = $this->repository)) {
            throw new \RuntimeException('The current Query object is not tied to any Repository');
        }

        return $repository->findOne($this->compileParameters());
    }
public function findOne ( Repository $ repository = null ) : Model { if ( ! $ repository && ! ( $ repository = $ this -> repository ) ) { throw new \ RuntimeException ( 'The current Query object is not tied to any Repository' ) ; } return $ repository -> findOne ( $ this -> compileParameters ( ) ) ; }
Loads a single resource Model given the current data.

@param Repository|null $repository

@throws \RuntimeException

@return Model
Loads a single resource Model given the current data .