Saturday, March 2, 2013

Re: beforeValidate can't modify my data

I'm not sure why you would unset the data you have in your validation array, eliminating your validation "catches", but... Two things. 

First, I would try adding the parent::beforeValidate, like below. Second, I would do some pr and exiting inside that if statement, make sure it's hitting, maybe even before the if and in the if.

public function beforeValidate( array $options = array() ) {
    if(empty($this->data['Photo']['image']['tmp_name'])) {
  unset($this->data['Photo']);
    }
    parent::beforeValidate( $options );
 }

Hope this helps in some fashion, I know things like this can be frustrating.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: