I'm stuck with an issue about relational active record: I have a couple of tables, Post and Author, that are defined as follows:
Post
id INT
author_id INT
post name VARCHAR(40)
Author
id INT
name VARCHAR(40)
last name VARCHAR(40)
The relations have been sorted out in each model. The question is, how to perform a "delete" action on both tables using the relations?
This is the code I've got but doesn't work:
Post::model()->with('author_relation')->deleteAll(
array(
'condition'=>'t.author_id=5',
)
);
It is supposed to delete the Author record with id 5 from the Author table AND the Post record from table Post where author_id = 5.
Thanks.

Help













