views:

284

answers:

1

Hi all!

I have many-to-many relations with the following tables.

post tag post_tag

I created three classes with Doctrine, so I have the following classes as well.

BasePost BaseTag BasePostTag

in the setUp() method, I defined relations. I like to delete tag record when I delete post record. So I simply put cascade as descirbed on Doctrine document.

$this->hasMany("Tag as Tags",array(
    'refClass' => 'PostTag',
    'local'=>'object_id',
    'foreign'=>'tag_id',
    'cascade'=> array('delete')
));

it works without a problem.

My questions is, how do I delete a record from post_tag table? Do I need to create a query myself?