Both the data and associations are correct.

My mistake was on what Nico said.
I've just forgot to return true inside beforeSave() method!

Thank you all guys!


On 23 fev, 03:30, Nico <ngev...@gmail.com> wrote:
> Another thing to check is the beforeSave() method to make sure that
> returns true. Are any of your other saves to the database working?
>
> On Feb 23, 7:48 am, Jeremy Burns <jeremybu...@me.com> wrote:
>
>
>
> > Have you checked to see if your data array is missing any required fields? 
> > If so, it would still pass validation but fail at the database level. Also, 
> > is your validation right (does it match what the database expects)?
>
> > Jeremy Burns
> > jeremybu...@me.com
>
> > On 22 Feb 2010, at 21:06, Lucca Mordente wrote:
>
> > > Hi there.
>
> > > I'm having problems saving a model and it's related data.
> > > a $this->Paper->saveAll($this->data); call returns false.
>
> > > and later I figured out that a simple $this->Paper->Document-
> > >> save($this->data) is failing too.
>
> > > the data is set correctly and there are no validationErrors.
>
> > > any suggestion?
> > > Thanks!
> > > Lucca
>
> > > the associations follow:
>
> > > Paper hasMany Chart
> > > Paper hasMany Table
> > > Paper hasMany Document
>
> > > PaperAttachment belongsTo Paper
>
> > > and the code:
>
> > > class Paper extends AppModel {
> > >    var $hasOne = array(
> > >        'Chart' => array(
> > >            'className'=>'PaperAttachment'
> > >        ),
> > >        'Table' => array(
> > >            'className'=>'PaperAttachment'
> > >        ),
> > >        'Document' => array(
> > >            'className'=>'PaperAttachment'
> > >        ),
> > >    );
> > > }
>
> > > class PaperAttachment extends AppModel {
> > >    var $belongsTo = array(
> > >        'Paper' => array(
> > >        )
> > >    );
> > > }
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to