Hi there,

i stuck in a problem which is perhaps obvious, but i didn't see the
solution right now.
It is a simple savell for a hasnone association. I try to edit the
primary and secondary data in one form. But the secondary data creates
always a new insert instead of updating it.

I think the naming conventions and the form is created correctly...
Address (addresses) hasOne AddressAddition (address_additions)

The Form
        echo $form->create('Address');
        echo $form->input('id');
        echo $form->input('title');
        echo $form->input('name');

        echo $form->input('AddressAddition.field_1');
        echo $form->input('AddressAddition.field_2');
        echo $form->input('AddressAddition.field_3');
        echo $form->end('Submit');

Which ends in the following data array:

Array
(
    [Address] => Array
        (
            [id] => 1
            [title] => 0
            [name] => Testname
        )

    [AddressAddition] => Array
        (
            [field_1] => 0
            [field_2] => 1
            [field_3] => 1
        )
)

Even if I add $form->input('AddressAddition.address_id') to the form
it did not save correctly.

UPDATE `addresses` SET `id` = 1, `title` = '0',  `name` = 'Testname'
INSERT INTO `address_additions` (`field_1`, `field_2`, `field_3`)
VALUES (1, 1, 1)

The second sql should be an update too...

Anyone got this problem?
--~--~---------~--~----~------------~-------~--~----~
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