Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

Prepping Data after Populate

posted by juanito 8 years ago

I have my script working right now but I want to apply one fuction trim to each field

$user->populate();
$user->setFirstname(trim($user->getFirstname()));

Can I configure it in somewhere to apply each time I use Store method?

Check it out: fORM#AddingFunctionalitytofActiveRecord

posted by xoan 8 years ago

The other option you have it to override the setFirstName method to always trim.

class User extends fActiveRecord
{
    function setFirstName($first_name)
    {
        return $this->set('first_name', trim($first_name));
    }
}
posted by wbond 8 years ago