When I create code using CRUD, and then load the page I have created I get this error:
Unknown Property – yii\base\UnknownPropertyException
Getting unknown property: app\controllers\PaymentController::request
I can fix it by changing this line in the controller
$dataProvider = $searchModel->search($this->request->queryParams);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
as well as adding
So my question is, why? Have I got something configured wrong?
Most probably you forgot to call
parent::init() in the
init() method of your
Thanks but I don’t think that’s it.
The output from CRUD didn’t include an init() method at all.
I tried adding
class PaymentController extends Controller
public function init()
and it still doesn’t work without my previous edit.
(The PaymentController extends Controller and is the class I am talking about that I generated with CRUD)
When you don’t have
init() there, you don’t need to add it with parent.
response change was added in 2.0.36. What is your version?
Aha you’ve got it, I’m using 2.0.35
When I upgraded to 2.0.36 it gave me problems with one extension I was using so I delayed upgrading.
So I guess I am okay to continue using the CRUD generated code and making minor edits to make it work for me.