コード例 #1
0
 /**
  * Renvoie une instance du modèle identifiée par sa clé primaire.
  * Si cette clé ne correspond à aucun objet, une erreur 404 est lancée.
  *
  * @param string $id
  * @return WebTag
  * @throws NotFoundHttpException
  */
 protected function findModel($id)
 {
     if (($model = WebTag::findOne($id)) !== null) {
         return $model;
     }
     throw new NotFoundHttpException('Modèle introuvable : #' . $id);
 }
コード例 #2
0
ファイル: WebNewsSearch.php プロジェクト: ChristopheBrun/hLib
 /**
  * @inheritdoc
  */
 public function displayActiveFilters($sep = ' - ')
 {
     $filters = [];
     if ($this->title) {
         $filters[] = Yii::t('labels', '(title)') . ' ' . $this->title;
     }
     if ($this->body) {
         $filters[] = Yii::t('labels', '(text)') . ' ' . $this->body;
     }
     if ($this->tagId) {
         /** @var WebTag $tag */
         $tag = WebTag::findOne($this->tagId);
         $filters[] = $tag ? $tag->label : '???';
     }
     return implode($sep, $filters);
 }