This bug was reported at https://trac.cakephp.org/ticket/4389 and also fixed
at https://trac.cakephp.org/changeset/7789. For me, saveAll() is working
fine for HABTM data with this fix

2009/1/6 AL <[email protected]>

>
> Hello!
>
> I am trying to save a model with HABTM using saveAll.
>
> hasOne, hasMany related models are saved correctly. But the HABTM
> model is not saved. It looks like it is fixed in 1.2 final release.
> Have anyone successfully save their HABTM with saveAll() ?
>
> This is my $data.
>
> Array
> (
>    [Student] => Array
>        (
>            [id] => 24
>            [first_name] => data[Student][first_name]
>            [last_name] => data[Student][last_name]
>            [ethic_name] => data[Student][ethic_name]
>            [gender] => 0
>            [birth_cert_no_fin_no] => data[Student]
> [birth_cert_no_fin_no]
>            [date_of_birth] => 2009-01-06
>            [picture] =>
>            [cda No] =>
>            [language_id] => 0
>            [race_id] => 1
>            [religion_id] => 1
>            [citizenship_id] => 1
>            [medical_conditions_disability] => data[Student]
> [medical_conditions_disability]
>            [allergies] => data[Student][allergies]
>            [sibling_name] => data[Student][sibling_name]
>            [sibling_date_of_birth] => 2009-01-06
>            [start_date] => 2009-01-06
>            [group_id] => 3
>            [append_class_log] =>
>            [school_bus] => 1
>            [fee_category_id] => 1
>            [status_id] => 1
>        )
>
>    [Address] => Array
>        (
>            [id] =>
>            [blk_no] =>
>            [unit_no] =>
>            [tower] =>
>            [street] =>
>            [country_id] => 1
>            [postal_code] =>
>        )
>
>    [ParentGuardian] => Array
>        (
>            [0] => Array
>                (
>                    [first_name] => data[ParentGuardian][0]
> [first_name]
>                    [last_name] => data[ParentGuardian][0][last_name]
>                    [nrice_fin_no] => data[ParentGuardian][0]
> [nrice_fin_no]
>                    [home_no] => home
>                    [handphone_no] => hand
>                    [office_no] => office
>                    [occupation] => data[ParentGuardian][0]
> [occupation]
>                    [marital_id] => 1
>                    [email_address] => [email protected]
>                    [relationship_id] => 1
>                    [id] => 3
>                )
>
>            [1] => Array
>                (
>                    [first_name] => data[ParentGuardian][1]
> [first_name]
>                    [last_name] => data[ParentGuardian][1][last_name]
>                    [nrice_fin_no] => data[ParentGuardian][1]
> [nrice_fin_no]
>                    [home_no] => mom home
>                    [handphone_no] => mom hand
>                    [office_no] => mom office
>                    [occupation] => data[ParentGuardian][1]
> [occupation]
>                    [marital_id] => 1
>                    [email_address] => [email protected]
>                    [relationship_id] => 2
>                    [id] => 4
>                )
>
>        )
>
>    [EmergencyContact] => Array
>        (
>            [0] => Array
>                (
>                    [name] => grandma
>                    [relationship] => r grandma
>                    [number] => 123123
>                    [id] => 46
>                )
>
>            [1] => Array
>                (
>                    [name] => grandpa
>                    [relationship] => r grandpa
>                    [number] => 123123
>                    [id] => 47
>                )
>
>            [2] => Array
>                (
>                    [name] => maid
>                    [relationship] => maid
>                    [number] => 123123
>                    [id] => 48
>                )
>
>        )
>
>    [SmsGroup] => Array
>        (
>            [SmsGroup] => Array
>                (
>                    [0] => 1
>                    [1] => 2
>                    [2] => 3
>                )
>
>        )
>
>    [Withdrawal] => Array
>        (
>            [level_id] => 4
>            [year] => 2009
>            [last_day_of_school] => Array
>                (
>                    [day] => 03
>                    [month] => 02
>                    [year] => 2009
>                )
>
>            [WithdrawalReason] => Array
>                (
>                    [WithdrawalReason] => Array
>                        (
>                            [0] => 1
>                        )
>
>                )
>
>            [reason] => test
>            [refunded] => 1
>            [refunded_to] => Father
>            [cheque_no] => OUB123123
>            [refund_amount] => 123
>            [id] => 1
>        )
>
> )
>
> HABTM relationships
> 1) Student HABTM SmsGroup
> 2) Student hasOne Withdrawal
> 3) Withdrawal HABTM WithdrawalReason
>
> 1) and 3) does not save when using saveAll()
>
> When calling save() and then followed by saveAll(), 1) is saved
> correctly with the rest of the models, but 3) is not saved. Is it
> because 3) is too nested?
>
> Thanks!
> Ai Leen
>
>
> >
>


-- 
Amit

http://amitrb.wordpress.com/
http://coppermine-gallery.net/
http://cheesecake-photoblog.org/
http://www.sanisoft.com/blog/author/amitbadkas

--~--~---------~--~----~------------~-------~--~----~
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