In my Company model i have set a default scope like this (and a exclusive scope class (behavior) to disable it:
public function behaviors()
{
return array(
'ExclusiveScope' => array('class'=>'ExclusiveScope')
);
}
/**
* Only view active companies
**/
public function defaultScope()
{
return $this->getIsExclusiveScope() ?
array() :
array(
'condition' => 'isActive = 1'
);
}
But now i have a problem. I have a dataprovider for Phone with a relation (user) in it (with a nested relation (user.company)). User is a relation of Phone and Company is a relation of User. In my Phone model i have this:
But i want to disable the default scope for company for this, so that is takes all companies, instead of the active (isActive) ones. How can i achieve this?
One of the nicest things doing like this is that, from this point on, you can have another MVC-set with this new ExclusiveCompany model. You can, for example, set specific AccessControl rules (e.g. a super user role), separating access to the (active) Company objects from the ExclusiveCompany objects (being all Company objects both active and non-active).