Friday, September 2, 2011

Re: saveAll not working

Are you calling
Model::create()
before you atempt to save the record?
Is your parent model validating?

I use save all a bunch and make it a habbit of checking these things.

Saveall works a-ok ;)

Sent from my iPhone

On Sep 2, 2011, at 9:29 AM, Stephen Latham <ste.latham@gmail.com> wrote:

> If you have a read of the manual it says you can either save multiple records of a single model using saveall, or a model and it's associated records. You are trying to do both at once with the save all. That's my understanding of it anyway - I had a similar issue with saveall so ended up just using foreach loops to save the data instead. I have used saveall where I wanted to do one or the other but never both at the same time as you are trying.
>
> Cheers Steve.
>
>
> On 2 Sep 2011, at 11:35, Dwayne Hanekamp <dwaynehanekamp@gmail.com> wrote:
>
>> Hey all,
>>
>> I'm building an application on which people need to fill in some
>> information and answer some questions.
>> I have two database tables:
>> Applications / Answers, Applications has a 'hasMany'-relationship with
>> Answers. The array coming from my form looks this way:
>>
>> Array
>> (
>> [Application] => Array
>> (
>> [name] => test
>> [email] => test@test.nl
>> [name] => test
>> [link] => test
>> )
>>
>> [Answer] => Array
>> (
>> [0] => Array
>> (
>> [question_id] => 1
>> [answer] => test
>> )
>>
>> [1] => Array
>> (
>> [question_id] => 2
>> [answer] => test
>> )
>>
>> )
>>
>> )
>>
>> When i try to do: $this->Application->saveAll($this-data); it simply
>> doesn't work.
>>
>> Does anyone have an idea?
>>
>> Thanks in advance!
>>
>> Dwayne
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
>>
>>
>> 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
>
> --
> Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
>
>
> 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

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: