Answer the question
In order to leave comments, you need to log in
Yii2: Why isn't an array returned?
Good afternoon.
There is a function that should return an object from the partner table as an array.
public function actionGetPartner($id){
$partner = Partner::find()->where(['id' => (int)$id])->asArray()->one();
return $partner;
}
Answer the question
In order to leave comments, you need to log in
But for some reason the error is:
Invalid Parameter - yii\base\InvalidParamException
Response content must not be an array.
If it's just a function, remove "action" from the name. Actions must return the server's response as a string (usually html or json).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question