/** * Constructor. * * Available options: * * * left_field: The left field name * * right_field: The right field name * * throw_global_error: Whether to throw a global error (false by default) or an error tied to the left field * * @param string $leftField The left field name * @param string $rightField The right field name * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorBase */ public function __construct($leftField, $rightField, $options = array(), $messages = array()) { $this->addOption('left_field', $leftField); $this->addOption('right_field', $rightField); $this->addOption('throw_global_error', false); parent::__construct(null, $options, $messages); }
public function __construct($loginField, $passwordField, $options = array(), $messages = array()) { $this->addOption('login_field', $loginField); $this->addOption('password_field', $passwordField); $this->addOption('throw_global_error', true); parent::__construct(null, $options, $messages); }
/** * Constructor. * * Available options: * * * challange_field: The challange field name * * response_field: The response field name * * throw_global_error: Whether to throw a global error (false by default) or an error tied to the response field * * @param string $challengeField The challange field name * @param string $responseField The response field name * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorBase */ public function __construct($challengeField, $responseField, $options = array(), $messages = array()) { $this->addOption('challenge_field', $challengeField); $this->addOption('response_field', $responseField); $this->addOption('throw_global_error', false); parent::__construct(null, $options, $messages); }
/** * Constructor. * * @param sfValidatorBase $validator Initial validator * @param integer $count The number of times to replicate the validator * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorBase */ public function __construct(sfValidatorBase $validator, $count, $options = array(), $messages = array()) { $fields = array(); for ($i = 0; $i < $count; $i++) { $fields[$i] = clone $validator; } parent::__construct($fields, $options, $messages); }
public function __construct($options = array(), $messages = array()) { $this->addMessage('no_delay', 'No delay found ! Please contact an administrator.'); $this->addMessage('no_subscription', 'No valid subscription found at this date ! Please contact an administrator.'); $this->addMessage('minimum_delay', 'You cannot book that soon. Minimum delay: %minimum_delay% minute(s).'); $this->addMessage('maximum_delay', 'You cannot book that far in the future. Maximum delay: %maximum_delay% day(s).'); parent::__construct(null, $options, $messages); }
/** * Constructor. * * Available options: * * * private_key: Your reCAPTCHA private key (app_recaptcha_private_key by default) * * throw_global_error: Whether to throw a global error (false by default) or an error tied to the response field * * @param sfForm $form The form to validate * @param string $captchaField The name of the sfWidgetFormReCaptcha * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorBase */ public function __construct($form, $captchaField, $options = array(), $messages = array()) { $this->addOption('form', $form); $this->addOption('captcha_field', $captchaField); $this->addOption('private_key', sfConfig::get('app_recaptcha_private_key')); $this->addOption('throw_global_error', false); parent::__construct(null, $options, $messages); }
/** * Constructor. * * Validator Options * * * control_field: (string) The control field name. * it will be "cleaned" by a sfValidatorBoolean. * According to the result of this, * the validator specified in the "validator_schema" option will be applied or not. * * * validator_schema: (sfValidatorSchema) The validator_schema which is to be applied * in case the sfValidatorBoolean applied to the control field returns true. * * * callback (string) [optional] a function to be called with the control_field as an argument. * If present, sfValidatorBoolean will not be applied to the control_field. * the validator defined in the "validator_schema" option * will be applied if this function returns true. * * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorBase */ public function __construct($options = array(), $messages = array()) { $this->addOption('control_field'); $this->addOption('validator_schema'); $this->addOption('throw_global_error', false); $this->addOption('callback'); parent::__construct(null, $options, $messages); }
public function __construct($options = array(), $messages = array()) { parent::__construct(null, $options, $messages); $this->addOption('members_count_field', 'members_count'); $this->addOption('guests_count_field', 'guests_count'); $this->addMessage('people_missing', 'Insufficient people count: you have %people_count% people, at least %needed_count% needed.'); $this->addMessage('too_much_people', 'Too much people: you have %people_count% people, at most %granted_count% granted.'); }
public function __construct($options = array(), $messages = array()) { $this->addMessage('invalid_max', 'You may not book for more than %maximum_duration% consecutive minutes.'); $this->addMessage('invalid_min', 'Minimum duration for a reservation is %minimum_duration% minutes.'); $this->addMessage('invalid_step', 'You may only book by periods of %step% minutes.'); $this->addMessage('no_duration', 'No duration found. Please contact your administrator !'); parent::__construct(null, $options, $messages); }
public function __construct($options = array(), $messages = array()) { $this->addRequiredOption('column1'); $this->addRequiredOption('column2'); // set defaults $this->addMessage('unique_error', 'Uniqueness error'); parent::__construct(null, $options, $messages); }
public function __construct($fields = null, $options = array(), $messages = array()) { if (!isset($options['ei_dataset_structure'])) { throw new Exception('ei_dataset_structure doit être passé en option au validateur'); } $this->str = $options['ei_dataset_structure']; $this->isNew = $options['is_new']; unset($options['ei_dataset_structure']); unset($options['is_new']); parent::__construct($fields, $options, $messages); }
/** * Constructor. * * Available options: * * * num_required: minimum amount of fields that must pass validation (default is 1) * * field_labels: field labels passed to the global_invalid message * * Available messages: * * * global_invalid: Global error thrown for the form * * @param string $fields Array of fields to choose from. These values are also passed to the global_invalid message * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorBase */ public function __construct(array $fields, $options = array(), $messages = array()) { $this->addOption('min_required', 1); $this->addOption('max_required', null); $this->addOption('fields', $fields); $this->addOption('labels', array()); $this->addOption('throw_global_error', true); $this->addMessage('min_invalid', 'You must fill out at least %num_required% of these fields'); $this->addMessage('max_invalid', 'You filled out too many fields. Only %num_required% allowed'); $this->addMessage('global_invalid', 'You filled out %num_valid% of %num_required% required fields below'); parent::__construct(null, $options, $messages); }
/** * This validator will execute $validators only if $callable called * with value of $conditionalField returns true. * * @param string $conditionalField The field that must be present to force validation * @param array|sfValidatorSchema $validators The validators to run * @param string $callable Function which must return true to launch $validators * @param array $options * @param array $messages */ public function __construct($conditionalField, $validators, $callable = 'strlen', $options = array(), $messages = array()) { if (!is_string($conditionalField)) { throw new sfException(sprintf('"%s" must be a string', $conditionalField)); } if (!is_callable($callable)) { throw new sfException(sprintf('"%s" is not callable', $callable)); } $this->addOption('conditional_field', $conditionalField); $this->addOption('callable', $callable); $this->addOption('conditional_validators', $validators); parent::__construct(null, $options, $messages); }
/** * Public constructor * * @param string $dateStartField The name of the start date field * @param string $dateEndField The name of the end date field * @param array $options Options array * @param array $messages Error messages array */ public function __construct($dateStartField, $dateEndField, $options = array(), $messages = array()) { // Validator options $this->addOption('date_start_field', $dateStartField); $this->addOption('date_end_field', $dateEndField); $this->addOption('min_duration', null); $this->addOption('max_duration', null); $this->addOption('disallow_future_dates', false); $this->addOption('disallow_past_dates', false); $this->addOption('throw_global_error', false); // Validation error messages $this->addMessage('future_date', 'The date cannot be in the future'); $this->addMessage('past_date', 'The date cannot be in the past'); $this->addMessage('too_short', 'The time interval between the two dates is too shortl'); $this->addMessage('too_long', 'The time interval between the two dates is too long'); $this->addMessage('start_not_prior', 'The start date must be prior to the end date'); // Parent constructor call parent::__construct(null, $options, $messages); }
public function __construct($options = array(), $messages = array()) { $this->addMessage('invalid', 'The specified password is incorrect'); $this->addOption('password_field', 'password'); parent::__construct(null, $options, $messages); }
public function __construct($options = array(), $messages = array()) { $this->addMessage('invalid', 'You cannot book in the past !'); parent::__construct(null, $options, $messages); }
public function __construct($options = array(), $messages = array()) { $this->addMessage('missing_count', 'Count cannot be null with the selected repetition type.'); $this->addMessage('missing_until_date', 'Until date cannot be null with the selected repetition type.'); parent::__construct(null, $options, $messages); }
/** * Constructor. * * @param string $field The field name * @param sfValidatorBase $validator The validator * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorBase */ public function __construct($field, sfValidatorBase $validator, $options = array(), $messages = array()) { $this->addOption('field', $field); $this->addOption('validator', $validator); parent::__construct(null, $options, $messages); }
/** * Constructor. * * @param array An array of options * @param array An array of error messages * * @see sfValidatorSchema */ public function __construct($options = array(), $messages = array()) { parent::__construct(null, $options, $messages); }
public function __construct($options = array(), $messages = array()) { $this->addMessage('null_period', 'You cannot specify 0 for all periods.'); parent::__construct(null, $options, $messages); }
/** * Constructor. * * @param array $options An array of options * @param array $messages An array of error messages * * @see sfValidatorSchema */ public function __construct($options = array(), $messages = array()) { $this->addRequiredOption('fields'); $this->addOption('throw_global_error', false); parent::__construct(null, $options, $messages); }
public function __construct($options = array(), $messages = array()) { $this->addMessage('invalid', 'You may not book more than %minutes_per_week% minutes in the same week. You already have %total%.'); $this->addMessage('no_hours_per_week', 'No hours per week found. Please contact your administrator !'); parent::__construct(null, $options, $messages); }
public function __construct(\Doctrine\ORM\EntityManager $em, $options = array(), $messages = array()) { $this->em = $em; parent::__construct(null, $options, $messages); }
public function __construct($options = array(), $messages = array()) { $this->addMessage('invalid', 'You do not have enough credits. Remaining credits (minutes): %remaining_credit%'); parent::__construct(null, $options, $messages); }