Example #1
0
 public function __construct($name, $parameters = array())
 {
     parent::__construct($name, $parameters);
     if (isset($parameters['scale'])) {
         $this->scale = intval($parameters['scale']);
     }
 }
Example #2
0
 public function getValidators()
 {
     $validators = parent::getValidators();
     if ($this->validation === null) {
         $validators[] = new Validator\Enum();
     }
     return $validators;
 }
Example #3
0
 public function getValidators()
 {
     $validators = parent::getValidators();
     if ($this->format !== null) {
         $validators[] = new Validator\RegExp($this->format);
     }
     return $validators;
 }
Example #4
0
 public function __construct($name, $parameters = array())
 {
     parent::__construct($name, $parameters);
     $this->dataType = $this->fieldType = 'float';
     if (isset($parameters['scale'])) {
         $this->scale = intval($parameters['scale']);
     }
 }
Example #5
0
 function __construct($name, $dataType, Base $entity, $parameters = array())
 {
     parent::__construct($name, $dataType, $entity, $parameters);
     if (empty($parameters['values'])) {
         $this->values = array(false, true);
     } else {
         $this->values = $parameters['values'];
     }
 }
Example #6
0
 function __construct($name, $dataType, Base $entity, $parameters = array())
 {
     parent::__construct($name, $dataType, $entity, $parameters);
     if (empty($parameters['values'])) {
         throw new \Exception(sprintf('Required parameter "values" for %s field in %s entity not found', $this->name, $this->entity->getNamespace() . '\\' . $this->entity->getName()));
     }
     if (!is_array($parameters['values'])) {
         throw new \Exception(sprintf('Parameter "values" for %s field in %s entity should be an array', $this->name, $this->entity->getNamespace() . '\\' . $this->entity->getName()));
     }
     $this->values = $parameters['values'];
 }
Example #7
0
 public function validateValue($value)
 {
     if (parent::validateValue($value)) {
         if ($this->format !== null) {
             // RETURN 'FORMAT'  (lang FIELD_INVALID_FORMAT)
             // or even return array('FORMAT')
             return (bool) preg_match($this->format, $value);
         }
         return true;
     }
     return false;
 }
 /**
  * All fields in exression should be placed as %s (or as another placeholder for sprintf),
  * and the real field names being carrying in $buildFrom array (= args for sprintf)
  *
  * @param string            $name
  * @param string            $expression
  * @param array|string|null $buildFrom
  * @param array             $parameters
  */
 public function __construct($name, $expression, $buildFrom = null, $parameters = array())
 {
     if (!isset($parameters['data_type'])) {
         $parameters['data_type'] = 'string';
     }
     parent::__construct($name, $parameters);
     $this->expression = $expression;
     if (!is_array($buildFrom) && $buildFrom !== null) {
         $buildFrom = array($buildFrom);
     } elseif ($buildFrom === null) {
         $buildFrom = array();
     }
     $this->buildFrom = $buildFrom;
 }
Example #9
0
 function __construct($name, $parameters = array())
 {
     parent::__construct($name, $parameters);
     $this->dataType = 'varchar';
     $this->fieldType = 'string';
     /*
     		if (!empty($parameters['format']))
     		{
     			$this->format = $parameters['format'];
     		}
     */
     if (isset($parameters['size']) && intval($parameters['size']) > 0) {
         $this->size = intval($parameters['size']);
     }
 }
Example #10
0
 function __construct($name, $parameters = array())
 {
     parent::__construct($name, $parameters);
     $this->dataType = $this->fieldType = 'enum';
     /*
     if (empty($parameters['values']))
     {
     	throw new SystemException(sprintf(
     		                          'Required parameter "values" for %s field in %s entity not found',
     		                          $this->name, $this->entity->getNamespace().$this->entity->getName()
     	                          ));
     }
     
     if (!is_array($parameters['values']))
     {
     	throw new SystemException(sprintf(
     		                          'Parameter "values" for %s field in %s entity should be an array',
     		                          $this->name, $this->entity->getNamespace().$this->entity->getName()
     	                          ));
     }
     */
     $this->values = $parameters['values'];
 }
Example #11
0
 public function __construct($name, $parameters = array())
 {
     ScalarField::__construct($name, $parameters);
 }
Example #12
0
 public function validateValue($value, $row, Result $result)
 {
     return $this->valueField->validateValue($value, $row, $result);
 }
Example #13
0
 public function fetchDataModification($value)
 {
     $value = intval($value);
     $value = parent::fetchDataModification($value);
     return $value;
 }
Example #14
0
 public function __construct($name, $parameters = array())
 {
     ScalarField::__construct($name, $parameters);
     $this->dataType = $this->fieldType = 'datetime';
 }
Example #15
0
 public function fetchDataModification($value)
 {
     $value = self::normalizeValue($value);
     $value = parent::fetchDataModification($value);
     return $value;
 }
Example #16
0
 public function validateValue($value)
 {
     return $this->valueField->validateValue($value);
 }