Maybe your database table engine does not support transactions. What engine are you using?
Lucca Mordente On 26 mar, 09:28, Ernesto <[email protected]> wrote: > Hello. > > i have 2 models (Item and Order) joined together by a HABTM > relationship. > since i need some additional fields (quantity) in the join table i > splitted the HABTM in 2x hasMany. > after that i coded a Order add form wich gives me this data array > > Array > ( > [Order] => Array > ( > [code] => SCORR > [customer_id] => 5 > [estimated_delivery] => 2010-03-30 > ) > > [ItemsOrders] => Array > ( > [0] => Array > ( > [item_id] => 10 > [quantity] => 3.00 > ) > > [1] => Array > ( > [item_id] => 5 > [quantity] => 5.00 > ) > > ) > > ) > > here's the related SQL log > > (default) 11 queries took 6 ms Nr Query Error > Affected > Num. rows Took (ms) > 1 DESCRIBE `orders` 3 3 1 > 2 DESCRIBE `items_orders` 4 4 1 > 3 DESCRIBE `items` 3 3 1 > 4 SELECT `Items`.`id`, `Items`.`code` FROM `items` AS `items` WHERE 1 > = 1 ORDER BY `code` ASC 9 9 0 > 5 START TRANSACTION 0 0 > 6 INSERT INTO `orders` (`code`, `customer_id`, `estimated_delivery`) > VALUES ('XYZ', 5, '2010-03-30') 1 0 > 7 SELECT LAST_INSERT_ID() AS insertID 1 1 0 > 8 ROLLBACK > > the strange thing is that, even if the transaction fails, the order is > added. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
