public function getInputFilter() { $maxvalidator = new Validator\StringLength(); $maxvalidator->setMax(50); $minvalidator = new Validator\StringLength(); $minvalidator->setMin(4); $email = new Input('email'); $email->getValidatorChain()->attach(new Validator\EmailAddress()); $email->getValidatorChain()->attach($maxvalidator); $email->getValidatorChain()->attach($minvalidator); $password = new Input('password'); $password->getValidatorChain()->attach($maxvalidator); $password->getValidatorChain()->attach(new Validator\StringLength(array('min' => 6))); $first_name = new Input('first_name'); $first_name->getValidatorChain()->attach($maxvalidator); $first_name->getValidatorChain()->attach($minvalidator); $user_name = new Input('username'); $user_name->getValidatorChain()->attach($maxvalidator); $user_name->getValidatorChain()->attach($minvalidator); $inputFilter = new InputFilter(); $inputFilter->add($email); $inputFilter->add($password); $inputFilter->add($first_name); $inputFilter->add($user_name); return $inputFilter; }
function __construct() { parent::__construct('merchant_setting'); $this->add(array('name' => 'alipay_account', 'type' => 'Text')); $this->add(array('name' => 'bank_type', 'type' => 'Text')); $this->add(array('name' => 'bank_account_name', 'type' => 'Text')); $this->add(array('name' => 'bank_account_card', 'type' => 'Text')); $this->add(array('name' => 'submit', 'type' => 'Submit')); /** * Setting up inputFilter */ $input_AlipayAccount = new Input('alipay_account'); $input_AlipayAccount->setRequired(false); $input_AlipayAccount->getValidatorChain()->attach(new \Zend\Validator\StringLength(array('max' => 50))); $input_AlipayAccount->getValidatorChain()->attach(new \Zend\Validator\EmailAddress()); $input_BankType = new Input('bank_type'); $input_BankType->setRequired(false); $input_BankType->getValidatorChain()->attach(new \Zend\Validator\StringLength(array('max' => 50))); $input_BankAccountName = new Input('bank_account_name'); $input_BankAccountName->setRequired(false); $input_BankAccountName->getValidatorChain()->attach(new \Zend\Validator\StringLength(array('max' => 50))); $input_BankAccountCard = new Input('bank_account_card'); $input_BankAccountCard->setRequired(false); $input_BankAccountCard->getValidatorChain()->attach(new \Zend\Validator\StringLength(array('max' => 50))); $input_BankAccountCard->getValidatorChain()->attach(new \Zend\Validator\Digits()); $input_filter = new InputFilter(); $input_filter->add($input_AlipayAccount); $input_filter->add($input_BankType); $input_filter->add($input_BankAccountName); $input_filter->add($input_BankAccountCard); $this->setInputFilter($input_filter); }
public function __construct(EntityExistValidator $entityExistValidator) { $this->inputFilter = new InputFilter(); $id = new Input('id'); $id->getValidatorChain()->attachByName('Digits')->attachByName('GreaterThan', ['min' => 0]); $id->getValidatorChain()->attach($entityExistValidator); $this->inputFilter->add($id); }
public function __construct() { $senha = new Input('senha'); $senha->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $senha->getValidatorChain()->attach(new NotEmpty()); $this->add($senha); $confsenha = new Input('conf-senha'); $confsenha->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $confsenha->getValidatorChain()->attach(new NotEmpty()); $confsenha->getValidatorChain()->attach(new Identical(array('token' => 'senha', 'messages' => array('notSame' => 'The two given passwords do not match', 'missingToken' => 'No password was provided to match against')))); $this->add($confsenha); }
public function __construct() { $num = new Input('num1'); $num->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $num->getValidatorChain()->attach(new NotEmpty()); $num->getValidatorChain()->attach(new Special()); $this->add($num); $num1 = new Input('num2'); $num1->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $num1->getValidatorChain()->attach(new NotEmpty()); $num1->getValidatorChain()->attach(new Special()); $this->add($num1); }
public function __construct() { $translator = new \Zend\I18n\Translator\Translator(); $translator->addTranslationFile('phparray', './module/Utenti/language/es.php'); $translatorMvc = new \Zend\Mvc\I18n\Translator($translator); \Zend\Validator\AbstractValidator::setDefaultTranslator($translatorMvc); $nombre = new Input('nome'); $nombre->setRequired(true); $nombre->getFilterChain()->attachByName('StripTags')->attachByName('StringTrim'); $nombre->getValidatorChain()->addValidator(new StringLength($this->opcionesStringLenght))->addValidator(new Alnum($this->opcionesAlnum)); $this->add($nombre); $password = new Input('password'); $password->setRequired(true); $password->getValidatorChain()->addValidator(new StringLength($this->opcionesStringLenght))->addValidator(new Alnum($this->opcionesAlnum)); $this->add($password); $confirmarPassword = new Input('confirmarPassword'); $confirmarPassword->setRequired(true); $confirmarPassword->getValidatorChain()->addValidator(new StringLength($this->opcionesStringLenght))->addValidator(new Alnum($this->opcionesAlnum))->addValidator(new Identical(array('token' => 'password', 'messages' => array('notSame' => 'I dati sono errati, riprova.')))); $this->add($confirmarPassword); $imagen = new FileInput('immagine'); $imagen->setRequired(false); $imagen->getFilterChain()->attach(new RenameUpload(array('target' => './httpdocs/immagine/utenti/utenti_', 'use_upload_extension' => true, 'randomize' => true))); $imagen->getValidatorChain()->attach(new Size(array('max' => substr(ini_get('upload_max_filesize'), 0, -1) . 'MB'))); /* $imagen->getValidatorChain()->attach(new MimeType(array( 'mimeType' => 'image/png,image/x-png,image/gif,image/jpeg,image/pjpeg', 'enableHeaderCheck' => true ))); */ $this->add($imagen); }
public function __construct(array $categoria = array()) { $this->categoria = $categoria; //Titulo $titulo = new Input('titulo'); $titulo->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $titulo->getValidatorChain()->attach(new NotEmpty()); $this->add($titulo); //Descricao $descricao = new Input('descricao'); $descricao->setRequired(false)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $this->add($descricao); //Texto $texto = new Input('texto'); $texto->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $texto->getValidatorChain()->attach(new NotEmpty()); $this->add($texto); //ativo $ativo = new Input('ativo'); $ativo->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $this->add($ativo); $inArray = new InArray(); $inArray->setOptions(array('haystack' => $this->haystack($this->categoria))); $categoria = new Input('category'); $categoria->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $categoria->getValidatorChain()->attach($inArray); $this->add($categoria); }
public function __construct(LabServiceInterface $labService, AssetServiceInterface $assetsService) { $labId = new Input('lab_id'); $labId->setRequired(true)->getFilterChain()->attach(new Filter\ToInt()); $labId->getValidatorChain()->attach(new Validator\NotEmpty()); $itemCategoryId = new Input('itemcategory_id'); $itemCategoryId->setRequired(true)->getFilterChain()->attach(new Filter\ToInt()); $itemCategoryId->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\Callback(['callback' => function ($value) use($assetsService) { try { $type = $assetsService->getItemCategoryById($value); return $type && $type['id'] == $value; } catch (Exception $ex) { return false; } }, 'message' => 'Ο τύπος εξοπλισμού δεν είναι έγκυρος'])); $qty = new Input('qty'); $qty->setRequired(true)->getFilterChain()->attach(new Filter\ToInt()); $qty->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\GreaterThan(['min' => 0])); $qtyacquired = new Input('qtyacquired'); $qtyacquired->setRequired(true)->getFilterChain()->attach(new Filter\ToInt()); $qtyacquired->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\GreaterThan(['min' => 0, 'inclusive' => true])); $reasons = new Input('reasons'); $reasons->setRequired(true)->getFilterChain()->attach(new Filter\StripTags())->attach(new Filter\StringTrim()); $reasons->getValidatorChain()->attach(new Validator\NotEmpty()); $this->add($labId)->add($itemCategoryId)->add($qty)->add($qtyacquired)->add($reasons); }
public function __construct() { $email = new Input('email'); $email->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $email->getValidatorChain()->attach(new NotEmpty()); $this->add($email); }
public function __construct() { $input = new Input('selectors'); $chain = $input->getValidatorChain(); $chain->attach(new Validator\ContentNegotiationSelectorsValidator()); $this->add($input); }
public function __construct() { $nome = new Input('descricao'); $nome->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $nome->getValidatorChain()->attach(new NotEmpty()); $this->add($nome); }
public function getInputFilter() { if (is_null($this->filter)) { $trackingIdValidator = new StringLength(36); $regexValidator = new Regex('/^[a-zA-Z0-9_-]+$/'); $trackingIdInput = new Input('trackingId'); $trackingIdInput->allowEmpty(); $trackingIdInput->setRequired(false); $trackingIdInput->getValidatorChain()->attach($trackingIdValidator)->attach($regexValidator); $inArrayValidator = new InArray(); $inArrayValidator->setHaystack(array_keys($this->locations)); $originInput = new Input('origin'); $originInput->getValidatorChain()->attach($inArrayValidator); $notSameValidator = new Callback(array('callback' => function ($value, $context = null) { if ($context) { return $value !== $context['origin']; } return true; }, 'messages' => array(Callback::INVALID_VALUE => 'Origin and Destination are the same'))); $destinationInput = new Input('final_destination'); $destinationInput->getValidatorChain()->attach($inArrayValidator)->attach($notSameValidator); $filter = new InputFilter(); $filter->add($trackingIdInput)->add($originInput)->add($destinationInput); $this->filter = $filter; } return $this->filter; }
public function buildFilter() { //category char 16 not null, $category = new Input('category'); $category->setAllowEmpty(TRUE); $category->getFilterChain()->attachByName('StringTrim')->attachByName('StripTags')->attachByName('StringToLower'); $category->getValidatorChain()->attachByName('inArray', array('haystack' => $this->categories)); //title varchar 128 not null $title = new Input('title'); $title->setAllowEmpty(TRUE); $title->getFilterChain()->attachByName('StringTrim')->attachByName('StripTags'); $titleRegex = new Regex(array('pattern' => '/^[a-zA-Z0-9 ]*$/')); $titleRegex->setMessage('Title should contain only numbers, letters or spaces.'); $title->getValidatorChain()->attach($titleRegex)->attachByName('StringLength', array('min' => 1, 'max' => 128)); //date_created timestamp not null default current_timestamp $dateCreated = new Input('dateCreated'); $dateCreated->getFilterChain()->attachByName('StringTrim')->attachByName('StripTags'); $dateCreated->getValidatorChain()->attachByName('StringLength', array('min' => 10, 'max' => 10)); // date_expires timestamp not null default null // descripton varchar 4096 default null // photo_filename varchar 1024 default null // contact_name varchar 255 default null // contact_email varchar 255 default null // contact_phone varchar 32 default null // city varchar 128 default null // country char 2 not null // price decimal 12,2 not null // delete_code char 16 character set utf8 collate utf8_bin default null $this->add($category)->add($title)->add($dateCreated); }
public function __construct() { $this->inputFilter = new InputFilter(); $id = new Input('id_equalTo'); $id->getValidatorChain()->attachByName('Digits')->attachByName('GreaterThan', ['min' => 0]); $id->setRequired(false); $mailTo = new Input('mailTo_like'); $mailTo->getFilterChain()->attachByName('StringTrim'); $mailTo->getValidatorChain()->attachByName('StringLength', ['min' => 0, 'max' => 50]); $mailTo->setRequired(false); $layoutId = new Input('layoutId_equalTo'); $layoutId->getValidatorChain()->attachByName('Digits')->attachByName('GreaterThan', ['min' => 0, 'max' => 1]); $layoutId->setRequired(false); $templateId = new Input('templateId_equalTo'); $templateId->getValidatorChain()->attachByName('Digits')->attachByName('GreaterThan', ['min' => 0, 'max' => 7]); $templateId->setRequired(false); $limit = new Input('limit'); $limit->getValidatorChain()->attachByName('Digits')->attachByName('GreaterThan', ['min' => 0]); $limit->setRequired(false); $page = new Input('page'); $page->getValidatorChain()->attachByName('Digits')->attachByName('GreaterThan', ['min' => 0]); $page->setRequired(false); $createdDtLessThen = new Input('createdDt_lessThan'); $createdDtLessThen->setRequired(false); $createdDtGreaterThan = new Input('createdDt_greaterThan'); $createdDtGreaterThan->setRequired(false); $this->inputFilter->add($id); $this->inputFilter->add($mailTo); $this->inputFilter->add($layoutId); $this->inputFilter->add($templateId); $this->inputFilter->add($limit); $this->inputFilter->add($page); $this->inputFilter->add($createdDtLessThen); $this->inputFilter->add($createdDtGreaterThan); }
public function __construct() { $login = new Input('login'); $login->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $login->getValidatorChain()->attach(new NotEmpty()); $this->add($login); }
public function __construct() { $input = new Input('userId'); $input->setRequired(true); $input->getValidatorChain()->attach(new \Zend\I18n\Validator\IsInt())->attach(new Validator\NotEmpty()); $this->add($input); $input = new Input('currencyFrom'); $input->setRequired(true); $input->getValidatorChain()->attach(new Validator\NotEmpty()); $this->add($input); $input = new Input('currencyTo'); $input->setRequired(true); $input->getValidatorChain()->attach(new Validator\NotEmpty()); $this->add($input); $input = new Input('amountSell'); $input->setRequired(true); $input->getValidatorChain()->attach(new \Zend\I18n\Validator\IsFloat())->attach(new Validator\NotEmpty()); $this->add($input); $input = new Input('amountBuy'); $input->setRequired(true); $input->getValidatorChain()->attach(new \Zend\I18n\Validator\IsFloat())->attach(new Validator\NotEmpty()); $this->add($input); $input = new Input('rate'); $input->setRequired(true); $input->getValidatorChain()->attach(new \Zend\I18n\Validator\IsFloat())->attach(new Validator\NotEmpty()); $this->add($input); $input = new Input('timePlaced'); $input->setRequired(true); $input->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\Date(['format' => 'd-M-y H:i:s'])); $this->add($input); $input = new Input('originatingCountry'); $input->setRequired(true); $input->getValidatorChain()->attach(new Validator\NotEmpty()); $this->add($input); }
public function __construct(EntityManager $objectManager) { // Nom $nom = new Input('nom'); $nom->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $nom->getValidatorChain()->attach(new NotEmpty())->attach(new StringLength(array('max' => 50))); $this->add($nom); // Image $image = new Input('image'); $image->setRequired(false); // TODO $this->add($image); // Date début $dateDebut = new Input('dateDebut'); $dateDebut->setRequired(true); //->getValidatorChain() //->attach(new DateTime(array('format' => 'd/m/Y'))); // TODO //$this->add($dateDebut); // Date fin $dateFin = new Input('dateFin'); $dateFin->setRequired(true); //->getValidatorChain() //->attach(new DateTime(array('format' => 'd/m/Y'))); // TODO //$this->add($dateFin); // TODO joueurs }
public function __construct(LabServiceInterface $labService, AssetServiceInterface $assetsService) { $id = new Input('id'); $id->setRequired(false)->getValidatorChain()->attach(new Validator\Digits()); $itemCategoryId = new Input('itemcategory_id'); $itemCategoryId->setRequired(true)->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\Callback(['callback' => function ($value) use($assetsService) { try { $itemCategory = $assetsService->getItemCategoryById($value); return isset($itemCategory['id']) && $itemCategory['id'] == $value; } catch (Exception $ex) { return false; } }, 'message' => 'Ο τύπος δεν βρέθηκε'])); $labId = new Input('lab_id'); $labId->setRequired(true)->getFilterChain()->attach(new Filter\ToInt()); $labId->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\Callback(['callback' => function ($value) use($labService) { try { $lab = $labService->getLabById($value); return isset($lab['id']) && $lab['id'] == $value; } catch (Exception $ex) { return false; } }, 'message' => 'Το εργαστήριο δεν βρέθηκε'])); $qty = new Input('qty'); $qty->setRequired(true)->getFilterChain()->attach(new Filter\Digits())->attach(new Filter\ToInt()); $qty->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\GreaterThan(['min' => 0])); $acquisitionYear = new Input('acquisition_year'); $acquisitionYear->setRequired(false)->getFilterChain()->attach(new Filter\Digits()); $acquisitionYear->getValidatorChain()->attach(new Validator\Date(['format' => 'Y']))->attach(new Validator\LessThan(['max' => date('Y'), 'inclusive' => true])); $comments = new Input('comments'); $comments->setRequired(false)->getFilterChain()->attach(new Filter\StripTags())->attach(new Filter\StringTrim()); $this->inputFilter = new InputFilter(); $this->inputFilter->add($id)->add($labId)->add($itemCategoryId)->add($qty)->add($acquisitionYear)->add($comments); }
public function __construct() { $search = new Input('search'); $search->getFilterChain()->attachByName('StripTags')->attachByName('StringTrim'); $search->getValidatorChain()->attachByName('StringLength', array('min' => 1, 'max' => 128)); $this->add($search); }
/** * CriarControllerFilter constructor. */ public function __construct() { # filter for strModuleName $strModuleName = new Input('strModuleName'); $strModuleName->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strModuleName->getValidatorChain()->attach(new NotEmpty()); $this->add($strModuleName); # filter for strFormName $strFormName = new Input('strFormName'); $strFormName->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strFormName->getValidatorChain()->attach(new NotEmpty()); $this->add($strFormName); # filter for strControllerName $strControllerName = new Input('strControllerName'); $strControllerName->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strControllerName->getValidatorChain()->attach(new NotEmpty()); $this->add($strControllerName); # filter for strRouteName $strRouteName = new Input('strRouteName'); $strRouteName->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strRouteName->getValidatorChain()->attach(new NotEmpty()); $this->add($strRouteName); # filter for strServiceName $strServiceName = new Input('strServiceName'); $strServiceName->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strServiceName->getValidatorChain()->attach(new NotEmpty()); $this->add($strServiceName); # filter for strEntityName $strEntityName = new Input('strEntityName'); $strEntityName->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strEntityName->getValidatorChain()->attach(new NotEmpty()); $this->add($strEntityName); }
/** * CriarControllerFilter constructor. */ public function __construct() { # filter for strForm $strForm = new Input('strForm'); $strForm->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strForm->getValidatorChain()->attach(new NotEmpty()); $this->add($strForm); # filter for strController $strController = new Input('strController'); $strController->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strController->getValidatorChain()->attach(new NotEmpty()); $this->add($strController); # filter for strRoute $strRoute = new Input('strRoute'); $strRoute->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strRoute->getValidatorChain()->attach(new NotEmpty()); $this->add($strRoute); # filter for strService $strService = new Input('strService'); $strService->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strService->getValidatorChain()->attach(new NotEmpty()); $this->add($strService); # filter for strEntity $strEntity = new Input('strEntity'); $strEntity->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $strEntity->getValidatorChain()->attach(new NotEmpty()); $this->add($strEntity); }
public function __construct(AuthenticationService $authService) { parent::__construct('login'); $this->filter = new InputFilter(); $email = new Element\Email('email'); $email->setAttribute('required', true); $email->setAttribute('placeholder', 'Email Address'); $this->add($email); $emailFilter = new Input('email'); $emailFilter->setRequired(true); $this->filter->add($emailFilter); $password = new Element\Password('password'); $password->setAttribute('required', true); $password->setAttribute('placeholder', 'Password'); $this->add($password); $passwordFilter = new Input('password'); $passwordFilter->setRequired(true); $passwordFilter->getValidatorChain()->attach(new AuthValidator\Authentication(array('message' => 'Invalid email address or password', 'service' => $authService, 'adapter' => $authService->getAdapter(), 'identity' => 'email', 'credential' => 'password'))); $this->filter->add($passwordFilter); $buttons = new Form('buttons'); $buttons->setOption('twb-layout', 'inline'); $buttons->setAttribute('class', 'form-group'); $submit = new Element\Submit('submit'); $submit->setAttribute('class', 'btn-primary pull-right'); $submit->setOption('glyphicon', 'log-in'); $submit->setLabel('Log In'); $buttons->add($submit); $forgot = new Element\Submit('forgot'); $forgot->setAttribute('formnovalidate', true); $forgot->setAttribute('class', 'btn-warning pull-right'); $forgot->setOption('glyphicon', 'question-sign'); $forgot->setLabel('Forgot Password'); $buttons->add($forgot); $this->add($buttons); }
public function __construct($uploadTmpPath, LabServiceInterface $labService, $attachmentSize) { $id = new Input('id'); $id->setRequired(false)->getValidatorChain()->attach(new Validator\Digits()); $name = new Input('name'); $name->setRequired(true)->getFilterChain()->attach(new Filter\StringTrim()); $name->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\StringLength(['min' => 3])); $labTypeId = new Input('labtype_id'); $labTypeId->setRequired(true); $labTypeId->getValidatorChain()->attach(new Validator\NotEmpty()); $isNew = new Input('is_new'); $isNew->setRequired(false)->getFilterChain()->attach(new Filter\ToInt()); $responsibleId = new Input('responsible_id'); $responsibleId->setRequired(false)->getValidatorChain()->attach(new Validator\Digits()); $area = new Input('area'); $area->setRequired(true)->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\Digits()); $lessons = new Input('lessons'); $lessons->setRequired(false); $lessons->getValidatorChain()->attach(new Validator\NotEmpty()); $attachment = new FileInput('attachment'); $attachment->setRequired(false)->getFilterChain()->attach(new Filter\File\RenameUpload(['target' => $uploadTmpPath, 'randomize' => true])); $attachment->getValidatorChain()->attach(new Validator\File\UploadFile())->attach(new Validator\File\MimeType(['application/zip', 'application/x-rar-compressed', 'application/octet-stream', 'application/pdf', 'image/png', 'image/jpeg', 'image/gif', 'image/bmp', 'image/vnd.microsoft.icon', 'image/tiff', 'image/tiff', 'image/svg+xml', 'image/svg+xml', 'image/vnd.adobe.photoshop']))->attach(new Validator\File\Size(['max' => $attachmentSize])); $use_ext_program = new Input('use_ext_program'); $use_ext_program->setRequired(false); $use_in_program = new Input('use_in_program'); $use_in_program->setRequired(false); $has_network = new Input('has_network'); $has_network->setRequired(false); $has_network->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\InArray(['haystack' => $labService->getHasNetworkValues()])); $has_server = new Input('has_server'); $has_server->setRequired(false); $has_server->getValidatorChain()->attach(new Validator\NotEmpty())->attach(new Validator\InArray(['haystack' => $labService->getHasServerValues()])); $this->inputFilter = new InputFilter(); $this->inputFilter->add($id)->add($name)->add($labTypeId)->add($isNew)->add($responsibleId)->add($area)->add($lessons)->add($attachment)->add($use_in_program)->add($use_ext_program)->add($has_server)->add($has_network); }
public function __construct() { // Email $email = new Input('email'); $email->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $email->getValidatorChain()->attach(new NotEmpty())->attach(new StringLength(array('max' => 255)))->attach(new EmailAddress()); $this->add($email); }
public function getValidators(ZfInput $input) { $validators = $input->getValidatorChain()->getValidators(); if ($input->isRequired()) { $validators[] = 'Zend\\Validator\\NotEmpty'; } return array_map(array($this, 'buildValidator'), $validators); }
public function __construct() { $name = new Input('name'); $name->getValidatorChain()->attach(new Validator\StringLength(['encoding' => 'UTF-8', 'min' => 2, 'max' => 140])); $subject = new Input('subject'); $subject->getValidatorChain()->attach(new Validator\StringLength(['encoding' => 'UTF-8', 'min' => 2, 'max' => 140])); $this->add($name)->add($subject); }
public function __construct(ServiceLocatorInterface $sl) { $translator = $sl->get('translator'); $email = new Input('email'); $email->setRequired(TRUE)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $email->getValidatorChain()->attach(new NotEmpty(['messages' => [NotEmpty::IS_EMPTY => $translator->translate('Field Required')]])); $this->add($email); }
public function __construct() { $this->add(array('name' => 'name', 'required' => TRUE, 'filters' => array(array('name' => 'StripTags')), 'validators' => array(array('name' => 'stringLength', 'options' => array('min' => 5, 'max' => 20))))); $e = new Input('password'); $e->setRequired(true); $e->getValidatorChain()->attach(new StringLength(array('encoding' => 'UTF-8', 'min' => 6, 'max' => 32))); $e->getFilterChain()->attach(new StringTrim()); $this->add($e); }
public function __construct() { $loginEmail = new Input('loginEmail'); $loginEmail->setRequired(true); $loginEmail->getFilterChain()->attachByName('StripTags')->attachByName('StringTrim'); $loginEmail->getValidatorChain()->addValidator(new EmailAddress(array('domain' => false))); $this->add($loginEmail); $this->add(array('name' => 'loginPassword', 'required' => true, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')))); }
public function __construct() { // Validações do titulo $titulo = new Input('titulo'); $titulo->setRequired(true)->getFilterChain()->attach(new StringTrim())->attach(new StripTags()); $titulo->getValidatorChain()->attach(new NotEmpty()); //** Adicionando filtros **// $this->add($titulo); }