> You could use a db trigger. Assuming you are using MySQL:
Never heard of these and has taken me 4 hours to get the right syntax and wrestle it into phpmyadmin. For anyone interested this is what I added (make sure to change the delimiter field to // before/after executing) DROP TRIGGER IF EXISTS `dnuk_app`.`asvr_insert`// CREATE TRIGGER `dnuk_app`.`asvr_insert` BEFORE INSERT ON `dnuk_app`.`annual_statistics_volunteer_roles` FOR EACH ROW BEGIN IF NEW.age1 IS NULL THEN SET NEW.age1 = 0; END IF; IF NEW.age2 IS NULL THEN SET NEW.age2 = 0; END IF; IF NEW.age3 IS NULL THEN SET NEW.age3 = 0; END IF; IF NEW.age4 IS NULL THEN SET NEW.age4 = 0; END IF; END // After I managed to add this and stop dancing around the room I was shocked to see it didn't help as MySQL was doing table checks before the trigger was being ran which meant my NOT NULL fields were stopping the insert. Once I allowed NULL values in the offending fields, MySQL let the query through so the trigger could do it's job. Still not sure if this is the most practical way to solve this issue, but allows me to use Cake's default behaviour and allow my database to worry about data integrity. Thanks, Paul. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
