User picture
By m4rw3r on Jan 14, 2009 @ 06:21pm UTC

Re: Behaviors that change data

What you can do is to change a property with the save_pre_strip_data, eg. title, then restore it on the save_pre_insert/update hooks:

class someclass{ // may be a behaviour or not, easier with a class, also possible with globals
    var $temp_title;

    function pre_strip_data(&$obj)
    {
        $this->temp_title = $obj->title;
        $obj->title = 'somestrangeandveryuncommonstring';
    }

    function pre_insert(&$data)
    {
         $data['title'] = $this->temp_title;
         // do something
    }
}

The drawback is that this will always update the title column, even if it is unchanged, but it is the best option for now (going to fix the $force option).

User picture
By Anonymous on Jan 15, 2009 @ 03:18pm UTC

Thanks, that sounds like a good workable solution!

Are you looking for core contributors?

 
 

On this conversation: