R
R
rrolegov2017-10-03 12:17:04
Yii
rrolegov, 2017-10-03 12:17:04

Why does the User model use late static binding?

Good afternoon, help me figure out the question of how the late binding mechanism is implemented in the User model, which is described in Yii2 advanced? How does inheritance chain work in a static::findOne expression, and in what context will the findOne function be executed as a result? Do I understand correctly that the static keyword here creates a reference to the context of the User class? And if the interpreter does not find an implementation of the findOne method, does it go further down the inheritance chain?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-10-03
@rrolegov

help me understand the question of how the late binding mechanism is implemented in the User model, which is described in Yii2 advanced?

just like in PHP
the interpreter checks for the presence of a method in the current class, if it does not exist, it checks for the presence / call of the method further down the inheritance hierarchy

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question