Thursday, September 30, 2010

saveAll not working

Can someone point out what I am doing wrong here? Trying to create and save User + Profile at the same time.

Fieldlist has some User and Profile fields

 

I have in the controller

 

if ( $this->User->validates() && $this->Captcha->validates( $this->data['User']['human'] ) ) {

 

$fieldList = array('id', 'role_id', 'firstname', 'lastname', 'security', 'confirm_code', 'ip', 'email', 'slug', 'id', 'type');

if( $this->User->saveAll( $this->data, array( 'validate' => 'first', 'atomic' => true, $fieldList ) ) ) {

//other stuff

}

}

 

It saves the data yet when I manually edit the form with Firebug adding other fields it saves it to the database even when its excluded from the safe fieldlist. Maybe it has to do with $data vs $this->data? not sure…

 

Does the model hold validation true after the if $this->User->validates() ? So then it skips the 'validate' => 'first', in the second call to validation?

 

Thanks,

Dave

 

 

No comments: