|
|
|
|
|
|
|
|
return $this->producer ; |
|
|
return $this->producer ; |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
|
|
|
$slug = \Yii::$app->getRequest()->getQueryParam('slug_producer'); |
|
|
$producer = Producer::find() |
|
|
$producer = Producer::find() |
|
|
->with('contact') |
|
|
->with('contact') |
|
|
->where(['slug' => \Yii::$app->getRequest()->getQueryParam('slug_producer')]) |
|
|
|
|
|
|
|
|
->where(['slug' => $slug]) |
|
|
->one() ; |
|
|
->one() ; |
|
|
|
|
|
|
|
|
if($producer) { |
|
|
if($producer) { |
|
|
$this->producer = $producer ; |
|
|
$this->producer = $producer ; |
|
|
return $this->producer ; |
|
|
return $this->producer ; |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
else { |
|
|
else { |
|
|
throw new \yii\web\HttpException(404, 'Producteur introuvable'); |
|
|
|
|
|
|
|
|
throw new \yii\web\HttpException(404, 'Producteur introuvable ('.$slug.')'); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |