Hi
I have following scenario and would like to know why it is not working.
I have one class ClassA extended from CActiveRecord
class ClassA extends CActiveRecord
{
}
and I can access fields of ClassA without any issue.
$a = new ClassA;
$a->title = "Title";
I have another class which should be derived from ClassA as it has almost all fields of ClassA but some additional, now if I do following
class ClassB extends ClassA
{
}
$b = new ClassB;
$b->title = "Title";
it fails saying that ClassB doesn’t have the property
Property "ClassB.title" is not defined.
I understand CActiveREcord checks for database metadata set to find the property.
my question is.
-
Does this mean every time we initiate a model class (derived from CActiveRecord) it fetches fields from database, or where does it keep this metadata, in which file so if we need we can modify.
-
Is there anyway I could let CActiveRecord ClassA’s metadataset from ClassB so that in above scenario it knows all the fields of ClassA and ClassB when accessing ClassB instance
Thanks