Example #1
0
 protected function fromInt($value)
 {
     if ($value < 0) {
         throw new InvalidValueException('UInt : negative values forbidden');
     }
     parent::fromInt($value);
 }
 public function prepValueForDB($value)
 {
     $value = parent::prepValueForDB($value);
     $ciphertext = $this->service->encrypt($value);
     $this->value = $ciphertext;
     return $ciphertext;
 }
 public function setValue($value, $record = null, $markChanged = true)
 {
     if ($record instanceof DataObject) {
         $this->object = $record;
     }
     parent::setValue($value, $record, $markChanged);
 }
Example #4
0
 /**
  * @param string $name
  * @param DataOject $object The object that this is primary key for (should have a relation with $name)
  */
 public function __construct($name = null, $object)
 {
     $this->object = $object;
     parent::__construct($name);
 }
 function __construct($name, $object = null)
 {
     $this->object = $object;
     parent::__construct($name);
 }
Example #6
0
 /**
  * Boolean to integer conversion
  * @return Int
  */
 public final function toInt()
 {
     $int = null;
     Int::create($int, $this);
     return $int;
 }
Example #7
0
 /**
  *
  * @param int $val
  */
 public function removeFlag($val)
 {
     Int::create($val);
     $this->setValue($val->bw_not()->bw_and($this));
 }
Example #8
0
 /**
  * @dataProvider provideTestFilter
  */
 public function testFilter($options, $raw, $filtered, $valid)
 {
     $int = new Int($options);
     $this->assertEquals($filtered, $int->filter($raw));
     $this->assertEquals($valid, $int->validate($raw));
 }
Example #9
0
 public function add($val)
 {
     $add = new Int($val);
     $this->val += $add->get();
     return $this;
 }