예제 #1
0
 /**
  * @param mixed $value
  * @return bool
  */
 protected function prohibit($value)
 {
     if (is_array($value) || is_object($value)) {
         return true;
     }
     $maxLength = $this->getAttribute('length');
     if (!is_null($value) && strlen($value) > $maxLength) {
         return true;
     }
     $value = $value ? strval($value) : $value;
     return parent::prohibit($value);
 }
예제 #2
0
 /**
  * @param mixed $value
  * @return bool
  */
 protected function prohibit($value)
 {
     if (true === $this->getAttribute('autoIncrement')) {
         return false;
     }
     if (is_array($value) || is_object($value)) {
         return true;
     }
     $primary = $this->getAttribute('primary');
     $unsigned = $this->getAttribute('unsigned');
     $pattern = false === $primary && false === $unsigned ? '/^-{0,1}[0-9]+$/' : '/^[0-9]+$/';
     if (!preg_match($pattern, $value)) {
         return true;
     }
     $min = true === $unsigned ? 0 : $this->min;
     $max = $this->max;
     if (!$this->between($value, $min, $max)) {
         return true;
     }
     return parent::prohibit($value);
 }