Here is the scenario-
I am using the latest cakephp v1.2 branch dated 30-08-08.

Lets say we have 1 model-
'Profile' with the following 'validate' array defined in the model-

var $validate = array(

                 'dob' => array(
                        'validDate' => array(
                                'rule' => 'validDate',
                                'message' => 'Please select a valid DOB'
                        ),
                        'isAdult' => array(
                                'rule' => array('isAdult',18),
                                'message' => 'You must be over 18'
                        )
                 )

        );


where 'validDate' is a custom validation function defined in AppModel.


Now, if I try saving this data-
$data = array(
'Profile' => array
        (
            'firstname' =>
           'user_desc' => chgfb dtgftgf
            'country_id' => 119
            'city' => delhi
            'zip' => 110092
            'submitted' =>
            'id' => 4
            'address' => ahsg
            'user_id' => 278
        )
)

with the following call-
$return = $this->Profile->saveAll($this->data, array('validate' =>
'first'));

It actually gives me a validation error on 'Profile'.


If I do-
var_dump($this->Profile->invalidFields());

This is what I get-
array
  'dob' => string 'Please select a valid DOB' (length=25)

However, If I try to validate this as follows-
$this->Profile->set($this->data);
$this->Profile->validates();
var_dump($this->Profile->invalidFields());
I do not get any error...

Problem is, that I need to use this Profile model with hasMany data
and hence need saveAll.

Is this a bug, or am I missing something?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to