Monday, February 22, 2010

Re: Another saveAll() problem

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
jeremyburns@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 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

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: