Am I right in assuming this would also delete the related records in Quote model? If not then how do I do this?
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’.
No except if your database would support something like Cascade delete… else do it manual… The easiest way is generate a model for te join table and do a ModelHasStuff::model()->deleteAllByAttributes(array(‘model_id’ => $model->id));
Umm oops sorry I thought you meant MANY_MANY x_x should learn how to read
Mysql InnoDB has support for this… else do something like
Am not sure if with works u should have to test it but i think Yii does not delete relationships automatic else just use Quotes::model()->deleteAllByAttributes(array(‘other_id’ =>$this->id));
Also note when using Quotes::model()->deleteAllByAttributes(array(‘other_id’ =>$this->id)); callbacks are not triggered e.g. any code in beforeDelete/afterDelete…