mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 16:24:04 +02:00
Menu: Defer construction of the Url object to Menu::getUrl()
Before, the Url object was constructed in Menu::setUrl() which lead to an exception when parsing a module's configuration.php from our CLI. refs #9375
This commit is contained in:
parent
b0a75dd89b
commit
1363ea4370
@ -43,7 +43,7 @@ class Menu implements RecursiveIterator
|
|||||||
/**
|
/**
|
||||||
* The url of this menu
|
* The url of this menu
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string|null
|
||||||
*/
|
*/
|
||||||
protected $url;
|
protected $url;
|
||||||
|
|
||||||
@ -404,21 +404,20 @@ class Menu implements RecursiveIterator
|
|||||||
*/
|
*/
|
||||||
public function setUrl($url)
|
public function setUrl($url)
|
||||||
{
|
{
|
||||||
if ($url instanceof Url) {
|
$this->url = $url;
|
||||||
$this->url = $url;
|
|
||||||
} else {
|
|
||||||
$this->url = Url::fromPath($url);
|
|
||||||
}
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the url of this menu
|
* Return the url of this menu
|
||||||
*
|
*
|
||||||
* @return Url
|
* @return Url|null
|
||||||
*/
|
*/
|
||||||
public function getUrl()
|
public function getUrl()
|
||||||
{
|
{
|
||||||
|
if ($this->url !== null && ! $this->url instanceof Url) {
|
||||||
|
$this->url = Url::fromPath($this->url);
|
||||||
|
}
|
||||||
return $this->url;
|
return $this->url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user