This format?
$state = $this->Order->OrdersPart->save($partsList);

$partsList=

Array
(
    [Order] => Array
        (
            [id] => 1
        )

    [Part] => Array
        (
            [Part] => Array
                (
                    [0] => Array
                        (
                            [item_id] => 20
                            [name] => BOLT,FLANGED,9X90
                            [code] => 92153-1610
                            [price] => 43647.00
                            [count] => 3
                        )

                    [1] => Array
                        (
                            [item_id] => 3
                            [name] => BOLT-SOCKET
                            [code] => 120CD0630
                            [price] => 15373.00
                            [count] => 1
                        )

                    [2] => Array
                        (
                            [item_id] => 14
                            [name] => BOLT,6X14
                            [code] => 92153-0406
                            [price] => 44197.00
                            [count] => 1
                        )

                    [3] => Array
                        (
                            [item_id] => 19
                            [name] => BOLT,6X45
                            [code] => 92153-0656
                            [price] => 40391.00
                            [count] => 2
                        )

                )

        )

)

This dont work.
Wher cookbook i can find it, there it doesnt?
http://book.cakephp.org/view/84/Saving-Related-Model-Data-hasOne-hasMany-belongsTo
http://book.cakephp.org/view/85/Saving-Related-Model-Data-HABTM


On 10 srp, 13:42, Marek Wojciech Urbanowicz
<[email protected]> wrote:
> You have to add index like Part.0.name etc. .. see in the cookbook
> W dniu 2010-08-10 13:38, Petr Vytlačil pisze:Hi I need save data to order and 
> orders_items and orders_parts, i try use: $this->Order->OrdersPart->save() or 
> $this->Order->saveAll() this array: Array ( [0] => Array ( [Order] => Array ( 
> [id] => 1 ) [Part] => Array ( [Part] => Array ( [item_id] => 20 [name] => 
> BOLT,FLANGED,9X90 [code] => 92153-1610 [price] => 43647.00 [count] => 3 ) ) ) 
> ) --- But this dont save data THX Model tables: orders HABTM items or parts 
> CREATE TABLE IF NOT EXISTS `orders` ( `id` int(11) NOT NULL AUTO_INCREMENT, 
> `mailingaddress_id` int(11) DEFAULT NULL, `billingaddress_id` int(11) NOT 
> NULL, `created` datetime DEFAULT NULL, `state` int(11) DEFAULT NULL, `note` 
> varchar(255) COLLATE utf8_czech_ci DEFAULT NULL, `user_id` int(11) NOT NULL, 
> PRIMARY KEY (`id`), KEY `fk_orders_users1` (`user_id`) ) ENGINE=MyISAM 
> DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ; CREATE TABLE IF 
> NOT EXISTS `orders_items` ( `id` int(11) NOT NULL AUTO_INCREMENT, `item_id` 
> int(11) NOT NULL, `order_id` int(11) NOT NULL, `name` varchar(255) COLLATE 
> utf8_czech_ci NOT NULL, `code` varchar(60) COLLATE utf8_czech_ci DEFAULT 
> NULL, `price` decimal(6,2) NOT NULL, `count` int(11) NOT NULL, PRIMARY KEY 
> (`id`,`item_id`,`order_id`), KEY `fk_items_has_orders_items1` (`item_id`), 
> KEY `fk_items_has_orders_orders1` (`order_id`) ) ENGINE=MyISAM DEFAULT 
> CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ; CREATE TABLE IF NOT 
> EXISTS `orders_parts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `order_id` 
> int(11) NOT NULL, `part_id` int(11) NOT NULL, `name` varchar(100) COLLATE 
> utf8_czech_ci NOT NULL, `code` varchar(100) COLLATE utf8_czech_ci NOT NULL, 
> `price` decimal(6,2) NOT NULL, `count` int(11) NOT NULL, `type` int(11) NOT 
> NULL, PRIMARY KEY (`id`,`order_id`,`part_id`), KEY 
> `fk_orders_has_parts_orders1` (`order_id`), KEY `fk_orders_has_parts_parts1` 
> (`part_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci 
> AUTO_INCREMENT=1 ; Check out the new CakePHP Questions 
> sitehttp://cakeqs.organd 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 
> [email protected] unsubscribe from this group, send email 
> [email protected] more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en--z poważaniemMarek Wojciech 
> Urbanowicz

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

Reply via email to