Monday, November 30, 2009

Re: saveAll - fieldList question

Well, It's not very elegant solution and I need to make those inserts
in one transaction.

On 13 Lis, 23:47, David Roda <davidcr...@gmail.com> wrote:
> I would probably split it into two calls
>
> assuming this code is in your Model1 model:
>
> $this->saveAll($data['Model1'], array('fieldList' => array('date')));
> $this->Model2->saveAll($data['Model2'], array('fieldList' =>
> array('date')));
>
>
>
> On Fri, Nov 13, 2009 at 8:52 AM, mattalexx <mattal...@gmail.com> wrote:
> > Any luck figuring this one out?
>
> > On Nov 5, 3:15 am, Raph <ra...@epoczta.pl> wrote:
> > > Hello,
>
> > > Let's say I have a model Model1 with fields 'name' and 'date' and I
> > > have a Model2 with field 'name'. Model1 is in relation 'hasMany' with
> > > Model2. How should I use saveAll() method with "fieldList" parameter
> > > if I only want to save all 'date' from Model1 and 'name' from Model2?
> > > It looks like in "fieldList" array only fields' names without models'
> > > names allowed i.e.
>
> > > This will work:
> > > $this->saveAll($data, array('fieldList' => array('date')));
>
> > > but this won't:
> > > $this->saveAll($data, array('fieldList' => array('date',
> > > 'Model2.0.name')));
>
> > > this won't either:
> > > $this->saveAll($data, array('fieldList' => array('date',
> > > 'Model2.name')));
>
> > > Any suggestions?
>
> > > --
> > > Raph
>
> > --
>
> > 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<cake-php%2Bunsubscribe@googlegroups.c om>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=.

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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: