Unverified Commit e6284b31 authored by victorvassilev's avatar victorvassilev Committed by GitHub
Browse files

fix(api): update hosts to return sanitized timezone string (#8576)



* fix(api): update hosts to return sanitized timezone string

* handle null time zone conversion to empty string

* add annotation

Co-authored-by: default avatarVictor Vassilev <victorvassilev@gmail.com>
parent 38858397
......@@ -252,6 +252,10 @@ Centreon\Domain\Monitoring\Host:
- 'resource_details_host'
timezone:
type: string
access_type: public_method
accessor:
getter: getSanitizedTimezone
setter: setTimezone
groups:
- 'host_main'
- 'host_full'
......
......@@ -1145,6 +1145,16 @@ class Host implements EntityDescriptorMetadataInterface
return $this->timezone;
}
/**
* @return null|string
*/
public function getSanitizedTimezone(): ?string
{
return (null !== $this->timezone) ?
preg_replace('/^:/', '', $this->timezone) :
$this->timezone;
}
/**
* @param string|null $timezone
* @return Host
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment