/** * 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); }
/** * 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); }
/** * 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); } }
public function testValue() { $property = new Morph_Property_Generic('TestProperty', 'TestValue'); $property->setValue('AValue'); $this->assertEquals('AValue', $property->getValue()); }