Hi, I'm using cakephp 1.2. I've 3 tables on mysql database: Customers (id, name, surname, code_id), Codes(id, customer_id), Jobs(id, type, date, code_id). When i insert a new Customer in the view and i press the button "Add" all the fields of Customers are filled with the data inserted and a code (code_id made by the id_surname_name) is generated for index the customers of my applications. I use this code for link the Job to a Customer. Customers and Codes are linked by hasone association between them. Of course on tables Customers and Jobs, code_id is a foreing key linked to Code.id set as primary key.
My application is almost done, i can add, delete, edit records of my DB. I set the delete cascade when i call the function delete in Customer Controller, so also the Code and the Jobs associated with the Customer are deleted. The problem is: how can i implement the "ON UPDATE CASCADE"? For example: If the user make a mistake when insert the data of a new customer (in this case he generates a wrong code) he can use the method EDIT for correct the info, the previous and wrong code must be overwritten with the new code_id, and when this code changes i want that ALL the Jobs records linked with that code changes the code_id automatically. How can i do that? Is there a way to do that with Cake? I didn't find an attribute, like 'dependent=true' for set the UPDATE CASCADE. I'm starting to think that Cake miss this function and i have to do that inside Mysql using CONSTRAINT and InnoDB engine...am i wrong? I hope someone can give me an help. Cheers John --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---