public function findModel($id, $slug = '')
    {
        if($this->_model === null) 
        {
            if(($this->_model = $id ? Post::findOne($id) : Post::findOne(['slug' => $slug])) !== null) 
            {
                return $this->_model;
            } else {
                throw new NotFoundHttpException(Module::t('core', 'The requested model does not exist.'));
            }
        }
    }
public function findModel($id, $slug = '')
    {
        if($this->_model === null) 
        {
            if(($this->_model = $id ? Post::findOne($id) : Post::findOne(['slug' => $slug])) !== null) 
            {
                return $this->_model;
            } else {
                throw new NotFoundHttpException(Module::t('core', 'The requested model does not exist.'));
            }
        }
    }
public function findModel ( $ id , $ slug = '' ) { if ( $ this -> _model === null ) { if ( ( $ this -> _model = $ id ? Post :: findOne ( $ id ) : Post :: findOne ( [ 'slug' => $ slug ] ) ) !== null ) { return $ this -> _model ; } else { throw new NotFoundHttpException ( Module :: t ( 'core' , 'The requested model does not exist.' ) ) ; } } }
Finds the Post model based on its primary key value.
If the model is not found, a 404 HTTP exception will be thrown.
@param integer $id
@param string $slug
@return Post the loaded model
@throws NotFoundHttpException if the model cannot be found
Finds the Post model based on its primary key value . If the model is not found a 404 HTTP exception will be thrown .