Browse Source

Exception message when getting write-only property

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

6
framework/yii/base/Component.php

@ -57,7 +57,11 @@ class Component extends Object
}
}
}
throw new UnknownPropertyException('Getting unknown property: ' . get_class($this) . '::' . $name);
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);
}
}
/**

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