deleting multiple child items by deleting parent

hi i have a class albums and another is media

what i want is

  1. that when ever an item of album is deleted it should first check that if there is a media item for it or not and warn the user.

  2. if media items are found then delete those media items on confirmation of user(all of them at once)

currently i have done is, when an album delete action is called it searches for media items for that album

but i cant figure out how to show user a message from that actionDelete in controller and how to delete the media items from here??

can anyone tell me how to do this in yii?

You can’t “show” a warning from the controller… but you can “render” a warning (a view file with a warning message and an option to proceed or cancel)… ;)

To delete the media items… you can use Media::model()->deleteAll() with a proper condition - http://www.yiiframew…eleteAll-detail

thanks it worked for me.