I have the following questions in yii php. I created an abstract class (Person) and two concrete classes: Teacher and Student. How should I set my model?
The attribute $ _identity; should be in class Person?
The Personclass should be the daughter of CFormModel class?
I have attached the image of the class to analyze
Do you use database and Person class is a mapping to a db table? Then it’s usually more convenient to extend CActiveRecord. If it doesn’t map to a db table then yes, you should use CFormModel.
Signing in functionality is usually more convenient to put into a separate class, for example LoginForm, extending it from CFormModel. You’ll have $_identity in this class.
Single table inheritance wiki article may be useful for you.