Пример #1
0
 /**
  * @param string $name
  * @param AbstractResourceFactory $resourceFactory
  * @param \Doctrine\ORM\EntityManager $entityManager
  * @param \Zf2FileUploader\Options\ImageResourceOptionsInterface $imageOptions
  */
 public function __construct($name = 'image', AbstractResourceFactory $resourceFactory, EntityManager $entityManager, ImageResourceOptionsInterface $imageOptions)
 {
     parent::__construct($name);
     $this->abstractResourceFactory = $resourceFactory;
     $validator = new ResourceTokenValidator($entityManager->getRepository($imageOptions->getImageEntityClass()));
     $this->getValidatorChain()->attach($validator);
 }
Пример #2
0
 public function __construct($name = '')
 {
     parent::__construct($name);
     if ($this->isRequired()) {
         /** @var $notEmpty \Zend\Validator\NotEmpty */
         $notEmpty = $this->getValidatorChain()->plugin('NotEmpty', array());
         $notEmpty->setMessages(array(Validator\NotEmpty::INVALID => 'Неверный тип значения. Ожидается строка, массив или тип boolean.', Validator\NotEmpty::IS_EMPTY => 'Значение обязательное и не может быть пустым'));
         $this->getValidatorChain()->prependValidator($notEmpty, true);
     }
 }
Пример #3
0
 /**
  * AbstractFilter constructor.
  * @param null $strName
  * @param array $arrToHaystack
  * @param bool $booRequired
  * @param bool $booSetDefaultValidators
  * @param int $intMinLength
  * @param int $intMaxLength
  */
 public function __construct($strName, array $arrToHaystack = array(), $booRequired = true, $booSetDefaultValidators = true, $intMinLength = 0, $intMaxLength = 0)
 {
     parent::__construct($strName);
     if (count($arrToHaystack)) {
         $this->getValidatorChain()->attach($this->getHaystackValidator($arrToHaystack));
     }
     if ($booRequired) {
         $this->setRequired($booRequired);
     }
     if ($booSetDefaultValidators) {
         $this->getFilterChain()->attach(new StripTags())->attach(new StringTrim());
     }
     $this->setMinAndMaxStringLengthValidator($intMinLength, $intMaxLength);
 }
Пример #4
0
Файл: Id.php Проект: t4web/crud
 public function __construct($name = null)
 {
     parent::__construct($name);
     $this->getFilterChain()->attachByName('StringTrim');
     $this->getValidatorChain()->attachByName('Digits')->attachByName('GreaterThan', ['min' => 0]);
 }
Пример #5
0
 /**
  * @param string $name
  * @param AbstractResourceFactory $resourceFactory
  */
 public function __construct($name = 'content', AbstractResourceFactory $resourceFactory)
 {
     $this->abstractResourceFactory = $resourceFactory;
     $this->scanner = new Scanner(ImageResource::UNIQUE_RESOURCE_PREFIX);
     parent::__construct($name);
 }
Пример #6
0
 public function __construct($name = null)
 {
     parent::__construct($name);
     $this->getFilterChain()->attach(new GeolocationFilter());
 }