@@ -9,7 +9,11 @@ class ProducerView extends \yii\web\View { | |||
var $subtitle ; | |||
public function getProducer() { | |||
return Etablissement::findOne(['slug' => Yii::$app->getRequest()->getQueryParam('slug_producer')]) ; | |||
$etablissement = Etablissement::findOne(['slug' => Yii::$app->getRequest()->getQueryParam('slug_producer')]) ; | |||
if($etablissement) | |||
return $etablissement; | |||
else | |||
throw new \yii\web\HttpException(404, 'Etablissement introuvable'); | |||
} | |||
public function setTitle($title, $icon = '') { |
@@ -15,6 +15,7 @@ class ProducerController extends CommonController { | |||
return [ | |||
'error' => [ | |||
'class' => 'yii\web\ErrorAction', | |||
], | |||
]; | |||
} |