On 13 Jul., 11:50, jakobjp <m...@jakobjp.net> wrote:
> Hi Joshua.
>
> Thanks for your response, but unfortunately you misunderstood the
> issue.
>
> I am NOT asking for the format of the $data array, but the $fieldList
> (an option that can be passed on to thesaveAll() function).
>
> According to the CakePHP docs (your link): "If $fieldListis not
> supplied, a malicious user can add additional fields to the form data,
> and by this change fields that were not originally intended to be
> changed."
>
> Now, passing an Array like below to $this->User->save($data,
> $fieldList) is fine:
> $fieldList= array(
> 'first_name',
> 'last_name',
> );
>
> QUESTION: How aboutsaveAll() with multiple Models (like in my example
> in the first post)? How should the $fieldListarray look?
>
> On Jul 13, 4:50 am, joshua <josh...@gmail.com> wrote:
>
>
>
> > > Take a look at the chapter ' 3.7.4 Saving Your Data<http://book.cakephp.org/view/75/Saving-Your-Data#Saving-Related-Model...>'
> > > in cakebook.
>
> > Array
> > (
> > [Article] => Array
> > (
> > [title] => My first article
> > )
> > [Comment] => Array
> > (
> > [0] => Array
> > (
> > [comment] => Comment 1
> > [user_id] => 1
> > )
> > [1] => Array
> > (
> > [comment] => Comment 2
> > [user_id] => 2
> > )
> > )
> > )
>
> > $this->Article->saveAll($data);
>
> > On Mon, Jul 13, 2009 at 4:34 AM, jakobjp <m...@jakobjp.net> wrote:
>
> > > I cannot get the $fieldListto work for Model->saveAll() not matter
> > > what I try.
>
> > > How should the $fieldListarray be formatted when storing a Model plus
> > > associated Models viasaveAll()?
>
> > > My example:
>
> > > Form fields:
> > > User.first_name
> > > User.last_name
> > > Address.street
> > > Address.city
> > > ...
>
> > > The two models User and Adresse are associated with the User "hasOne"
> > > Address.
>
> > --
> > Thanks
> > Joshua
> > 5span Inc. <https://www.5span.com>
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment