saveAll and update issue across multiple models

3 messages Options
Embed this post
Permalink
appel268576

saveAll and update issue across multiple models

Reply Threaded More More options
Print post
Permalink

Hi there.

I have a bit of an issue.
I am working on creating a post model that handles multiple postmeta
data for easily creating scalable forms.

I have the two models

post:

var $hasMany = array('Meta' =>
                array('className' => 'Meta',
                        'foreignKey' => 'post_id',
                        'order' => 'Meta.id ASC',
                        'dependent' => true,
                        'unique' => true,
                        'recursive' => '1'
                )
        );

I find it works fine when i create a new post with any amount of meta
fields set in the form.

When i delete the post it deletes all the meta information which is
perfect.

However when I update the information, instead of making use of the
previous information, it creates and saves new information to the
database...

Where I am going wrong?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

robustsolution

Re: saveAll and update issue across multiple models

Reply Threaded More More options
Print post
Permalink

Dear appel268576,

It seems your edit form does not include the id of each child record,
that is why when you submit, new records are creating as if you are in
create mode!!!

have a nice baking day
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

appel268576

Re: saveAll and update issue across multiple models

Reply Threaded More More options
Print post
Permalink

Hi robustsolution.

So If I just include the id's for each field it should solve the
problem?

On Nov 2, 2:44 pm, robustsolution <[hidden email]> wrote:
> Dear appel268576,
>
> It seems your edit form does not include the id of each child record,
> that is why when you submit, new records are creating as if you are in
> create mode!!!
>
> have a nice baking day

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---