public function actionView($url)
{
$a = Posts::findOne(['url' => $url]);
$id = $a->id; //или $id = $a['id']; - если findOne переопределён на asArray
$model = $this->render('view', [
'model' => Posts::findOne($id),
]);
return $model;
}
public function actionView($url)
{
return $this->render('view', [
'model' => $this->findModel($url),
]);
}
private function findModel($id)
{
...
$model = Posts::findOne($id);
...
private function findModel($url)
{
...
$model = Posts::findOne(['url' => $url]);
...
$agrList = func_num_args();
...
'posts/<alias>' => 'post/view',
...
...
public function actionView($alias) {
...
...
$model = Article::findOne(['statia' => $alias]);
...