I found it. :)

$this->Post->Attachment->saveAll($fakedata['Attachment']); works

on
http://book.cakephp.org/view/1031/Saving-Your-Data :

"Note that we are passing $data['Article'] instead of usual $data.
When saving multiple records of same model the records arrays should
be just numerically indexed without the model key."


Many, many thanks for your sugestions Jeremy, wouldn't have figured it
out without you.

On 8 Jun, 09:57, homem-arvore <[email protected]> wrote:
> It think so:
>
> post model:
>
> var $hasMany = array(
>         'Attachment' => array(
>                 'className' => 'Attachment',
>                 'foreignKey' => 'post_id',
>                 'dependent' => true,
>         )
> );
>
> attachment model:
>
> var $belongsTo = array(
>         'Post' => array(
>                 'className' => 'Post',
>                 'foreignKey' => 'post_id',
>         ),
> );
>
> On 8 Jun, 09:48, Jeremy Burns | Class Outfit
>
>
>
>
>
>
>
> <[email protected]> wrote:
> > Have you got your model associations set up correctly?
>
> > Jeremy Burns
> > Class Outfit
>
> > [email protected]http://www.classoutfit.com
>
> > On 8 Jun 2011, at 09:45, homem-arvore wrote:
>
> > > $this->Post->saveAll($fakedata); does not work
>
> > > $this->Post->Attachment->saveAll($fakedata); actually works
>
> > > I think I'm almost there understanding how it works... My current
> > > theory :P is that saveAll only saves multiple records they're related
> > > data.
>
> > > --
> > > Our newest site for the community: CakePHP Video 
> > > Tutorialshttp://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > [email protected] For more options, visit this group 
> > > athttp://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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to