M
M
McMike2017-01-25 12:05:13
Yii
McMike, 2017-01-25 12:05:13

Why does Yii2 implement the impossibility of accessing undeclared fields?

For example, if there is no type field in the class, then the call to $myClass->type will not terminate the program, but if it is written in the framework class, then it starts to swear at /vendor/yiisoft/yii2/base/Component.php
throw new UnknownPropertyException( 'Getting unknown property: ' .get_class($this) .'::' .$name)
This already infuriates, it seems that everything is fine at the testing stage, but in a battle in some situation it starts to break.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-01-25
@McMike

calling $myClass->type will not terminate the program

only if you disable errors
He does the right thing, do not refer to non-existent methods and attributes
drink valerian

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question