Example #1
0
 /**
  * Initialize field (used by extending classes)
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     if ($this->_startDate || $this->_endDate) {
         $this->_validators[] = ['validator' => 'Between', 'options' => ['minimum' => $this->_startDate, 'maximum' => $this->_endDate, 'messages' => "The date must be between '" . $this->_startDate . "' and '" . $this->_endDate . "'"]];
     }
 }
Example #2
0
 /**
  * Initialize field (used by extending classes)
  *
  * @return void
  */
 protected function _init()
 {
     if (null === $this->_id) {
         $this->_required = true;
     }
     parent::_init();
     $this->_validators[] = ['validator' => 'StringLength', 'options' => ['min' => $this->_length]];
 }
Example #3
0
 /**
  * Initialize field (used by extending classes)
  *
  * @return void
  */
 protected function _init()
 {
     if (null === $this->_id) {
         $this->_required = true;
     }
     parent::_init();
     $passwrodField = $this->_form->getFieldByKey($this->_confirmField);
     $passwrodField->addValidator(['validator' => 'Confirmation', 'options' => ['with' => $this->_key, 'message' => $this->_errorMessage]]);
 }
Example #4
0
 /**
  * Initialize field (used by extending classes)
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     /*$this->_validators[] = [
     			'validator' => 'Regex',
     			'options' => [
     				'pattern' => '/^([a-zA-Z0-9_\.\-+])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/i',
                     'messages' => "Invalid mail address"
     			]
     		];*/
     $this->_validators[] = 'email';
 }
Example #5
0
 /**
  * Initialize field (used by extending classes)
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     if ($this->_lengthMax || $this->_lengthMin) {
         $options = [];
         if ($this->_lengthMax) {
             $options['max'] = $this->_lengthMax;
         }
         if ($this->_lengthMin) {
             $options['min'] = $this->_lengthMin;
         }
         $this->_validators[] = ['validator' => 'StringLength', 'options' => $options];
     }
 }
Example #6
0
 /**
  * Initialize field (used by extending classes)
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     /*if (null !== $this->_extensions) {
           $this->_validators[] = [
               'validator' => 'FileExtension',
               'options' => [
                   $this->_extensions
               ]
           ];
       }
       $this->_validators[] = array(
           'validator' => 'FileCount',
           'options' => [
               'min' => 0,
               'max' => 1
           ],
       );*/
 }
Example #7
0
 /**
  * Initialize field (used by extending classes)
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     if ($this->_name) {
         throw new \Engine\Exception("Outdated ManyToMany settings for " . get_class($this->_form) . " - " . get_class($this->_model));
     }
     if (!$this->_noTableReference) {
         $workingModel = $this->_getWorkModel();
         $relationsRefModel = $workingModel->getRelationPath($this->_model);
         if (!$relationsRefModel) {
             throw new \Engine\Exception("Did not find relations between '" . get_class($this->_workingModel) . "' and '" . get_class($this->_model) . "'");
         }
         $mainModel = $this->_form->getContainer()->getModel();
         $relationsMainModel = $workingModel->getRelationPath($mainModel);
         if (!$relationsMainModel) {
             throw new \Engine\Exception("Did not find relations between '" . get_class($this->_workingModel) . "' and '" . get_class($mainModel) . "'");
         }
         $this->_name = array_shift($relationsRefModel)->getFields();
         $this->_keyParent = array_shift($relationsMainModel)->getFields();
     }
     $this->setAttrib("autoLoad", true);
 }
Example #8
0
 /**
  * Initialize field (used by extending classes)
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     $model = $this->_form->getContainer()->getModel();
     $this->_name = $model->getNameExpr();
 }
Example #9
0
 /**
  * Initialize field (used by extending classes)
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     $this->_validators[] = array('validator' => 'Regex', 'options' => ['pattern' => '/^(http|https|ftp)\\://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\\-\\._\\?\\,\'/\\\\+&%\\$#\\=~])*$/']);
 }
Example #10
0
 /**
  * Initialize field (used by extending classes)
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     $this->_validators[] = array('validator' => 'Regex', 'options' => ['pattern' => '/^[ +()_-\\d]{6,}(\\s(x|ext\\.?)\\s?\\d{3,4})?$/i']);
 }
Example #11
0
 /**
  * Initialize field (used by extending classes)
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     $this->_validators[] = ['validator' => 'Numericality', 'options' => []];
     $this->_validators[] = ['validator' => 'Between', 'options' => ['minimum' => $this->_min, 'maximum' => $this->_max, 'messages' => "The value must be between '" . $this->_min . "' and '" . $this->_max . "'"]];
 }