I’m trying to get my head ahead models in 2.0 and getting stuck with something really basic! I have some functions on a model, some static some not, but if i try and access them i just get this error
Call to undefined method Yii::app()
I’m trying to access them either like this
$value=MyModel::myStaticFunction();
(in 1.x I would have something like MyModel::model()->myFunction();
or
$model= new MyModel();
$value=model->myOtherFunction();
Can’t seem to get either to work at all but must be doing something silly…?
Yii::app()
// use this instead
Yii::$app
MyModel::model()
// has been renamed to
MyModel::find()
// however this should work fine
$model= new MyModel();
$value=model->myOtherFunction();
Thanks, just so I can read up where is the first point you mention in the docs? I looked at the model section of the guide to 2.0 but didn’t spot that point.