I am using Doctrine 1.2 in my project. The schema.yml file contains:
Campaign:
tableName: campaign
actAs:
Timestampable:
created:
name: created_datetime
type: timestamp
format: Y-m-d H:i:s
updated:
disabled: true
columns:
id:
type: integer(9)
fixed: false
unsigned: false
primary: true
autoincrement: true
...
relations:
CampaignImages:
local: id
foreign: campaign_id
type: many
cascade: [delete]
...
CampaignImages:
tableName: campaign_images
columns:
id:
type: integer(9)
fixed: false
unsigned: false
primary: true
autoincrement: true
campaign_id:
type: integer(9)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
...
I have defined CampaignImages::delete() method and put some debugging code there, but it does not get executed when Campaign::delete() is called.
Isn't cascade:[delete] meant precisly for this reason? I don't want to use database level cascades, because image files associated with CampaignImage must be deleted when deleting record.