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 the saveAll() function).

According to the CakePHP docs (your link): "If $fieldList is 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 about saveAll() with multiple Models (like in my example
in the first post)? How should the $fieldList array look?






On Jul 13, 4:50 am, joshua <[email protected]> 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 <[email protected]> wrote:
>
> > I cannot get the $fieldList to work for Model->saveAll() not matter
> > what I try.
>
> > How should the $fieldList array be formatted when storing a Model plus
> > associated Models via saveAll()?
>
> > 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 [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