Hi all,

I'm having some problems with saving HABTM relationships, and I was hoping
you could help me.  The two models in question are Registrant and Product.

In my Registrant model, I have a method that builds an array that looks like
this:

Array
(
    [Registrant] => Array
        (
            [id] => 133
        )

    [Product] => Array
        (
            [0] => Array
                (
                    [product_id] => 1
                    [quantity] => 5
                    [cost] => 25.00
                )

            [1] => Array
                (
                    [product_id] => 2
                    [quantity] => 1
                    [cost] => 8.50
                    [option_id] => 13
                )

            [2] => Array
                (
                    [product_id] => 2
                    [quantity] => 9
                    [cost] => 76.50
                    [option_id] => 14
                )

            [3] => Array
                (
                    [product_id] => 2
                    [quantity] => 3
                    [cost] => 25.50
                    [option_id] => 15
                )

        )

)

When I try using $this->saveAll($array) it does nothing, and when I
try using $this->Product->saveAll($array), this is the SQL it runs:

44START TRANSACTION0045SELECT `ProductsRegistrant`.`registrant_id`
FROM `products_registrants` AS `ProductsRegistrant` WHERE
`ProductsRegistrant`.`product_id` = ''11046DELETE `ProductsRegistrant`
FROM `products_registrants` AS `ProductsRegistrant` WHERE
`ProductsRegistrant`.`product_id` = '' AND
`ProductsRegistrant`.`registrant_id` = (130)1047INSERT INTO
`products_registrants` (`product_id`,`registrant_id`) VALUES
('','133')1048COMMIT

I've been playing with this for quite a while and I can't figure out
what's wrong. Could someone offer some guidance, please?

--~--~---------~--~----~------------~-------~--~----~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to