/** * Validates a person object * * @param ComPeopleDomainEntityPerson $person * * @return boolean */ public function validateEntity($person) { //if a password is set then validate the password if ($password = $person->getPassword()) { if (!$this->getFilter('password')->validate($password)) { $person->addError(array('message' => 'Invalid password format', 'code' => AnError::INVALID_FORMAT, 'key' => 'password')); } } return parent::validateEntity($person); }
/** * Initializes the default configuration for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. * * @return void */ protected function _initialize(KConfig $config) { parent::_initialize($config); $config->append(array('validations' => array('name' => array('format' => 'hashtag')))); }
/** * Initializes the default configuration for the object. * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. */ protected function _initialize(KConfig $config) { parent::_initialize($config); $config->append(array('validations' => array('name' => array('format' => 'string'), 'body' => array('format' => 'post')))); }