Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

HAS_MANY relation and delete

$
0
0
Here is a relation in my Enquiry model:

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


In my EnquiryController if I have the following:

$model=Enquiry::model()->with('quotes')->findByPk($_GET['id']);

$model->delete();


1) Am I right in assuming this would also delete the related records in Quote model? If not then how do I do this?

2) How can I add a condition that 'extends' from the relation? So for example I need a condition that checks 'accepted=1' and a condition that checks 'approved=1'.

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>