Create a method for the field in the form class:
public function updateManufacturerColumn($value) { return (!$value) ? null : $value; }Manufacturer is the name of the field now.
public function updateManufacturerColumn($value) { return (!$value) ? null : $value; }Manufacturer is the name of the field now.
public function configure() { $this->getValidator('day')->setOption('required', 'true'); $this->validatorSchema->setPostValidator(new sfValidatorAnd(array( new sfValidatorCallback(array('callback' => array($this, 'checkFields'))), ))); } public function checkFields($validator, $values) { if(empty($values['manufacturer']) && empty($values['category_apollo_kod']) && empty($values['product_apollo_kod'])) { throw new sfValidatorErrorSchema($validator, array('manufacturer' => new sfValidatorError($validator, 'custom error'))); } return $values; }
$v = new sfValidatorEmail(); try { $v->clean(trim($email)); } catch (sfValidatorError $e) { // not valid }
class sfValidatorEmail extends sfValidatorRegex { // const REGEX_EMAIL = '/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i'; // const REGEX_EMAIL = '/^([^@öüóőúéáűíÖÜÓŐÚÉÁŰÍ\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i'; const REGEX_EMAIL = '/^([A-Z0-9._%+-]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i'; /** * @see sfValidatorRegex */ protected function configure($options = array(), $messages = array()) { parent::configure($options, $messages); $this->setOption('pattern', self::REGEX_EMAIL); } }