コード例 #1
0
ファイル: String.php プロジェクト: kulobone/mongodb
 /**
  * Sets the value of this attribute
  *
  * @param integer $Value
  */
 public function setValue($value)
 {
     $cleanValue = strval($value);
     if (!empty($this->MaximumLength) && strlen($cleanValue) > $this->MaximumLength) {
         //throw validation exception
         $cleanValue = substr($cleanValue, 0, $this->MaximumLength);
     }
     parent::setValue($cleanValue);
 }
コード例 #2
0
ファイル: Float.php プロジェクト: kulobone/mongodb
 /**
  * Sets the value of this attribute
  *
  * @param float $Value
  */
 public function setValue($value)
 {
     $cleanValue = floatval($value);
     if (!empty($this->Minimum) && $cleanValue < $this->Minimum) {
         //throw validation exception
         $cleanValue = $this->Minimum;
     }
     if (!empty($this->Maximum) && $cleanValue > $this->Maximum) {
         //throw validation exception
         $cleanValue = $this->Maximum;
     }
     parent::setValue($cleanValue);
 }
コード例 #3
0
ファイル: Enum.php プロジェクト: kulobone/mongodb
 /**
  * Overrides parent setValue to add enum value checking
  *
  * @see classes/ar/ar_Field#setValue()
  */
 public function setValue($value)
 {
     if ($this->isValidEnum($value)) {
         parent::setValue($value);
     }
 }
コード例 #4
0
ファイル: TestProperties.php プロジェクト: kulobone/mongodb
 public function testValue()
 {
     $property = new Morph_Property_Generic('TestProperty', 'TestValue');
     $property->setValue('AValue');
     $this->assertEquals('AValue', $property->getValue());
 }