Browse Source

Exception message when getting write-only property

tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
9a4d7ff15b
  1. 4
      framework/yii/base/Component.php
  2. 2
      framework/yii/base/Object.php

4
framework/yii/base/Component.php

@ -57,8 +57,12 @@ class Component extends Object
}
}
}
if (method_exists($this, 'set' . $name)) {
throw new InvalidCallException('Getting write-only property: ' . get_class($this) . '::' . $name);
} else {
throw new UnknownPropertyException('Getting unknown property: ' . get_class($this) . '::' . $name);
}
}
/**
* Sets the value of a component property.

2
framework/yii/base/Object.php

@ -70,6 +70,8 @@ class Object implements Arrayable
$getter = 'get' . $name;
if (method_exists($this, $getter)) {
return $this->$getter();
} elseif (method_exists($this, 'set' . $name)) {
throw new InvalidCallException('Getting write-only property: ' . get_class($this) . '::' . $name);
} else {
throw new UnknownPropertyException('Getting unknown property: ' . get_class($this) . '::' . $name);
}

Loading…
Cancel
Save