Do you use any IDE? Like Netbeans or PHPStorm? If not I strongly suggest to start using one of those because it will make your coding life 1000000% easier and you will not have problems like the one you have given.
you should take a look to the Yii2 API documentation as it describes all methods (the '$this-> functions) and members (the $this-> variables) for all classes of yii2.
For example check out the Public Method section of Controller Doc …
every item you see on that page in blue can be used with $this->…
also, they type refers to what the value after the attribute has to be.
i.e.
in the controller docs Under Public Properties
there is a property called layout. The type says strin|boolean so that means it can only be a string or boolean
$this->layout='someSting';
$this->layout=FALSE;//true would also be valid
are the only two valid types for layout. Same logic goes for all documentation.
Also, if you are in any of the subclasses listed on that page then $this->… for controller would still be accessible because it would be inherited. However, in each of the subclasses there will be more options that would now be accessible with $this->…
furthermore, $this just refers to the current class your in.
so if you were in a view $this->… would now refer to yii\base\View
I’d spend some time learning how to read docs. The yii2 docs are just like any other docs and will make your life a lot easier in the long run when using plugins, extension and just coding with yii2.