MonitoredObject: Implement awesome __isset()

This commit is contained in:
Alexander Fuhr 2014-09-30 14:47:17 +02:00
parent ac2aeca9e6
commit e6c674e221
1 changed files with 11 additions and 1 deletions

View File

@ -442,7 +442,7 @@ abstract class MonitoredObject
{
if (property_exists($this->properties, $name)) {
return $this->properties->$name;
} elseif (isset($this->$name)) {
} elseif (property_exists($this, $name) && $this->$name !== null) {
return $this->$name;
} elseif (property_exists($this, $name)) {
$fetchMethod = 'fetch' . ucfirst($name);
@ -458,6 +458,16 @@ abstract class MonitoredObject
throw new InvalidPropertyException('Can\'t access property \'%s\'. Property does not exist.', $name);
}
public function __isset($name)
{
if (property_exists($this->properties, $name)) {
return isset($this->properties->$name);
} elseif (property_exists($this, $name)) {
return isset($this->$name);
}
return false;
}
/**
* @deprecated
*/