Вот код чтобы получить объект полностью
Код: Выделить всё
public function actionWay($ref)
{
$model = $this->findModel($ref);
return $model;
}
protected function findModel($ref)
{
if (($model = Link::find()->andwhere(['code_link' => $ref])->one())) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
Invalid Argument – yii\base\InvalidArgumentException
Response content must be a string or an object implementing __toString().
Пробовал выводить массивом
Код: Выделить всё
if (($model = Link::find()->andwhere(['code_link' => $ref])->asArray()->one())) {
Как быть?Response content must not be an array.