/** * @param $alias * @return null|static * @throws NotFoundHttpException */ protected function findCategoryWithAlias($alias) { $category = Category::findOne(['alias' => $alias]); if ($category == null) { throw new NotFoundHttpException(Yii::t('app', 'Category not found')); } return $category; }