Why Yii2 realized the impossibility of recourse to neobjavljeni fields?

For example, if the class is missing field type, the reference to $myClass->type not gonna put the program if the register is in the class framework, then starts to swear at /vendor/yiisoft/yii2/base/Component.php
throw new UnknownPropertyException('Getting unknown property:' . get_class($this) . '::' . $name)

Hate it already, like on the testing stage it flows normally on combat in some situation starts to break down.
August 19th 19 at 23:44
1 answer
August 19th 19 at 23:46
Solution
appeal to $myClass->type not put the program

only if you disable error

if to register it in the class framework, then starts to swear

Rightly so, it is not necessary to refer to non-existent methods and attributes

It infuriates already

drink Valerian
It's a bad practice to add object properties "on the fly"? It may just need in a local place and that now all this is to register the class? - kariane_Schiller76 commented on August 19th 19 at 23:49
Yes - lauryn9 commented on August 19th 19 at 23:52
OK, I guess I've just been sitting on an old project where this have been overlooked - kariane_Schiller76 commented on August 19th 19 at 23:55

Find more questions by tags Yii