public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('username', 'not_empty')->rule('username', function ($value) { return ORM::factory('User')->where('username', '=', $value)->find()->loaded(); }); // Check if the username exists }
public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('version', 'exact_length', array(':value', 10))->rule('version', 'digit')->rule('steps', 'digit'); }
public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('name', 'not_empty')->rule('name', array($this, 'config_exists')); }
public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('module', 'not_empty')->rule('module', 'in_array', array(':value', array_keys(Kohana::modules())))->rule('name', 'not_empty')->rule('type', 'in_array', array(':value', array('number', 'chart'))); }
public function build_validation(Validation $validation) { $config = Kohana::$config->load('installer'); $locales = array_keys(I18n::available_langs()); return parent::build_validation($validation)->rule('db_server', 'not_empty')->rule('db_port', 'not_empty')->rule('db_port', 'numeric')->rule('db_user', 'not_empty')->rule('username', 'not_empty')->rule('email', 'not_empty')->rule('email', 'email')->rule('cache_type', 'not_empty')->rule('cache_type', 'in_array', array(':value', array_keys($this->_installer->cache_types())))->rule('session_type', 'in_array', array(':value', array_keys($this->_installer->session_types())))->rule('db_driver', 'in_array', array(':value', array_keys($this->_installer->database_drivers())))->rule('locale', 'in_array', array(':value', $locales))->rule('admin_dir_name', 'not_empty'); }
public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('username', 'not_empty')->rule('password', 'not_empty')->rule('email', 'not_empty')->rule('email', 'email'); }
public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('folder', 'is_dir')->rule('database', 'numeric')->rule('filesystem', 'numeric'); }
/** * Add extra parameter validation */ public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('source', 'not_empty')->rule('source', 'in_array', array(':value', array('api', 'sql')))->rule('url', 'url')->rule('url', function ($validation, $field, $value, $data) { if ($data['source'] == 'api' and !Valid::not_empty($value)) { $validation->error($field, 'not_empty'); } }, array(':validation', ':field', ':value', ':data'))->rule('use-external', function ($validation, $field, $value, $data) { if ($value === TRUE) { return TRUE; } if (is_string($value) and !Valid::url($value)) { $validation->error($field, 'url'); } return FALSE; }, array(':validation', ':field', ':value', ':data'))->rule('username', function ($validation, $field, $value, $data) { if ($data['source'] == 'sql' and !Valid::not_empty($value)) { $validation->error($field, 'not_empty'); } }, array(':validation', ':field', ':value', ':data'))->rule('database', function ($validation, $field, $value, $data) { if ($data['source'] == 'sql' and !Valid::not_empty($value)) { $validation->error($field, 'not_empty'); } }, array(':validation', ':field', ':value', ':data'))->rule('clean', function ($validation, $field, $value, $data) { if ($value !== FALSE and is_string($data['use-external'])) { $validation->error($field, 'incompatible_use_external'); } }, array(':validation', ':field', ':value', ':data'))->rule('batch-size', 'numeric')->rule('form-id', 'numeric')->rule('oauth-client-id', 'not_empty')->rule('oauth-client-secret', 'not_empty')->rule('dest-username', 'not_empty'); }
/** * Validate parameters passed to the task. */ public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('do', 'not_empty')->rule('do', 'in_array', array(':value', array('migrate', 'init_session'))); }
/** * Validate the CLI options. * * @param Validation The validation object to add rules to * * @return Validation */ public function build_validation(Validation $validation) { $val = parent::build_validation($validation); $val->rule('count', 'numeric'); return $val; }
public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('view', 'not_empty')->rule('view', 'Kohana::find_file', array('views', ':value')); }
/** * Configure validation of command line parameters - must be provided and the vendor path must be a valid path * * @param Validation $validation the validation object to configure * * @return Validation */ public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('vendor-path', 'not_empty')->rule('vendor-path', array('Task_Twbs_Publishassets', 'valid_path'))->rule('public-path', 'not_empty'); }
public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('headers', 'not_empty')->rule('resource', 'not_empty'); // Require this parameter. }
public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('name', 'not_empty'); }
/** * Configure validation of command line parameters - must be provided and the vendor path must be a valid path * * @param Validation $validation the validation object to configure * * @return Validation */ public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('vendor-path', 'not_empty')->rule('vendor-path', array('Task_Twbs_Publishassets', 'valid_path'))->rule('public-path', 'not_empty')->rule('no-compress', 'numeric')->rule('lint-only', 'numeric')->rule('loop-after', 'numeric'); }
public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('module', 'not_empty')->rule('module', 'in_array', array(':value', array_keys(Kohana::modules())))->rule('model', 'not_empty')->rule('model', 'Jam::meta'); }
public function build_validation(Validation $validation) { return parent::build_validation($validation)->rule('metrics', 'not_empty')->rule('start_date', 'strtotime')->rule('end_date', 'strtotime')->rule('start_index', 'digit')->rule('result', "in_array", array(':value', array('total', 'rows')))->rule('max_results', 'digit'); }