public function actionType($id) { $modelType = new Type(); $modelProduct = new Product(); foreach ($modelType->getType($id) as $type) { $typeName = $type; } $products = $modelProduct->getWithType($typeName); return $this->render('type', ['products' => $products, 'typeName' => $typeName]); }