Once again an update of the advanced validation approach

This is hopefully the last post about the advanced validation approach for a long time ;-)

As the previous update this update is only for users using CakePHP with a version number higher than 1.0.1.2708 (you find the version number in VERSION.txt). And that is the update: replace the following snippet in the invalidFields() function in your AppModel:

if ($data == null)
{
    if (isset($this->data))
    {
        $data = $this->data;
    }
    else
    {
        $data = array();
    }
}

with

if (isset($this->data))
{
    $data = array_merge($data, $this->data);
}

The reason for that update is that if you modify data in a possible beforeValidate() function, these changes are ignored by the invalidFields() function without this update.

Post a Comment

Required fields are marked *
*
*

%d bloggers like this: