If you do not want the orphaned records you could just use CASCADE instead of
restrict.
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
It appears I have imagined a problem where there was none. I have just
tested creating and deleting a Trainer:
User hasOne Trainer
dependent = true
InnoDB relation in trainers table with delete = RESTRICT
Trainer hasMany CourseTrainer
dependent = true
InnoDB relation in course_trainers
Most of the time I want the orphan records to be deleted, as they would
have been done by CakePHP (using dependent=true) if I did not have the
MySQL relations in place.
It was very rare that I created orphans in my code before using MySQL
relations, as I use counterCache a lot and where I
Spurred into action (eventually) by Jeremy Burn's (ClassOutfit) talk at
CakeFest Manchester, I have for the first time tuned my database and
included referential integrity relations. The database is now doing
everything that it should be, i.e. stopping me from deleting records that
would
I've seen a setup which *forces* you to re-assign all children to another
parent node, not always the most effective.
Curious to see what other people have to suggest as this is something I
need to tackle also.
On 27 February 2012 16:24, phpMagpie p...@webbedit.co.uk wrote:
Spurred into action