Hi there,
For security reason I am using a default scope with the owner
This is in the model ClientDocument default scope:
public function defaultScope() {
return array(
'condition' => 'id_user = ' . Yii::app()->user->id,
);
}
This model is used in a relation in model Client:
public function relations() {
return array(
'clientDocuments' => array(self::HAS_MANY, 'ClientDocument', 'id_client'),
);
}
So I can use $client->clientDocuments to access the documents.
Now the problem I have is that in my administrator view I want to see and approve the documents.
But I can’t find a way to reset the scope. I get an error when I call $client->clientDocuments (SQL error, it’s using WHERE id_client = ‘admin’).
Any idea?
Thanks
Renaud