Extending relations

Here is a relation in my Enquiry model:

'quotes'=>array(self::HAS_MANY, 'Quote', 'enquiry_id'),

How can I add conditions that ‘extend’ from the above relation? So for example a condition that checks ‘accepted=1’ and another condition that checks ‘approved=1’.

Of course I can just create separate relations, but I want to use the above as a ‘base’ relation from where I can simply extend from with different conditions.

Anyone able to advise a solution?

Can you give a more detailed info? Do you extend AR class or do you want to "extend" relation within the same class? What about using scopes?

I dunno lol. Basically I got 4 relations here:

'all_quotes'=>array(self::HAS_MANY, 'Quote', 'enquiry_id'),

'received_quotes'=>array(self::HAS_MANY, 'Quote', 'enquiry_id', 'condition'=>'received = 1'),

'accepted_quotes'=>array(self::HAS_MANY, 'Quote', 'enquiry_id', 'condition'=>'accepted = 1'),

'approved_quotes'=>array(self::HAS_MANY, 'Quote', 'enquiry_id', 'condition'=>'approved = 1'),

Can you see what I mean now. Instead of having those last three relations, I want to be able to just call the first relation and then add on a condition(s) in the call.

I just had a look at scopes - is that how it should be done?

You can either use relational scopes or add the conditions to a critera (for example the constructor of CActiveDataProvider). Did you read this page (especially the topics on the bottom)?