Home > Article > Backend Development > In-depth learning of Yii2--inheritance relationship, in-depth learning of yii2--_PHP tutorial
If you want to understand Yii2, you must understand the inheritance relationship of related classes in Yii2. Due to the limited code that can be read temporarily, only part of the inheritance relationships are listed in the figure below, which will be added later as more and more source codes are read
As you can see from the above figure, most classes in Yii2 inherit from yiibaseObject and implement the function of attributes.
yiibaseComponent, yiibaseEvent and yiibaseBehavior both inherit yiibaseObject. yiibaseComponent is a base class that implements properties/events and behavior functions. yiibaseEvent is the base class for all events, and yiibaseBehavior is the base class for all behaviors.
Model/View and Controller both inherit from yiibaseComponent.
I’m tired today, so I’ll be lazy and write less, that’s all O(∩_∩)O
Students who are interested in the Yii2 source code can pay attention to the project yii2-2.0.3-annotated. A lot of comments about the Yii2 source code have been added to it, and they will continue to be added in the future~
Interested students can also participate and submit comments on the Yii2 source code.