MonitoredObject: Implement awesome __isset()
This commit is contained in:
parent
ac2aeca9e6
commit
e6c674e221
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue