/** * Adds a trim filter if it doesn't already exist. * * @param string $model * @param string $column * @return void **/ public function initialize($model, $column) { parent::initialize($model, $column); if ($this->trim) { $this->filters += array($this->null ? 'Field_String::trim' : 'trim' => null); } }
/** * Adds an email validation rule if it doesn't already exist. * * @param string $model * @param string $column * @return void **/ public function initialize($model, $column) { parent::initialize($model, $column); if (count($this->rules) > 0) { // If rules can be found check if the rule for e-mail is set foreach ($this->rules as $rule) { if (is_string($rule[0]) and $rule[0] === 'email') { // E-mail rule is set no need to continue return; } } } // Add the rule for e-mail $this->rules[] = array('email'); }
/** * Adds a filter that hashes the password. * * @param Jelly_Model $model * @param mixed $column * @return void */ public function initialize($model, $column) { parent::initialize($model, $column); // Add a filter that hashes the password when validating $this->filters[] = array(array(':field', 'hash'), array(':value', ':model')); }