Hi, I have two classes, one of which extends the other. On both of them I have defaultScopes() set.
How do I make the second one not override the first one?
Let me show as an example:
Class A {
(...)
public function defaultScope()
{
return array(
'condition' => 'some.condition = here'
);
}
}
Class B extends A {
(...)
public function defaultScope()
{
return array(
'condition' => 'some.other.condition = here'
);
}
}
So, when I call B::model()->findAll(), for example, only B’s defaultScope is run.
I could have done
Class B extends A {
(...)
public function defaultScope()
{
return array_merge(parent::defaultScope(), array(
'condition' => 'some.other.condition = here'
));
}
}
But that would not work either, since ‘condition’ would get overriden anyway.
Any suggestions as to how can I run both A’s defaultScope() and B’s?
Thanks!