Tuesday, February 28, 2012

Re: Best way to work with MySQL table relations (referential integrity)

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 did not want to delete a record if it had dependents I would check against the counterCache value.

It seems I have potentially took one step forward and two steps back.  I value the fact that the database WILL NOT allow me to create orphans as a safety net, but if I have to create extra code to allow me to delete a record and it's dependents, something that was done automatically beforehand, then I think I will be removing the MySQL relations :(

--
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.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: