Add Secondary Storage support to the Event object

This commit is contained in:
Isaac Connor
2019-07-24 11:22:55 -04:00
parent afa02e436d
commit 58851d23d2

View File

@@ -12,6 +12,7 @@ class Event {
'Name',
'MonitorId',
'StorageId',
'SecondaryStorageId',
'Name',
'Cause',
'StartTime',
@@ -85,6 +86,19 @@ class Event {
return $this->{'Storage'};
}
public function SecondaryStorage( $new = null ) {
if ( $new ) {
$this->{'SecondaryStorage'} = $new;
}
if ( ! ( array_key_exists('SecondaryStorage', $this) and $this->{'SecondaryStorage'} ) ) {
if ( isset($this->{'SecondaryStorageId'}) and $this->{'SecondaryStorageId'} )
$this->{'SecondaryStorage'} = Storage::find_one(array('Id'=>$this->{'SecondaryStorageId'}));
if ( ! ( array_key_exists('SecondaryStorage', $this) and $this->{'SecondaryStorage'} ) )
$this->{'SecondaryStorage'} = new Storage(NULL);
}
return $this->{'SecondaryStorage'};
}
public function Monitor() {
if ( isset($this->{'MonitorId'}) ) {
$Monitor = Monitor::find_one(array('Id'=>$this->{'MonitorId'}));