mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 01:04:12 +02:00
ObjectController: refactor initalization
This commit is contained in:
parent
34d5e445b2
commit
13c09855fa
@ -63,8 +63,15 @@ abstract class ObjectController extends ActionController
|
||||
{
|
||||
parent::init();
|
||||
$this->enableStaticObjectLoader($this->getTableName());
|
||||
|
||||
if ($this->getRequest()->isApiRequest()) {
|
||||
$this->initializeRestApi();
|
||||
} else {
|
||||
$this->initializeWebRequest();
|
||||
}
|
||||
}
|
||||
|
||||
protected function initializeRestApi()
|
||||
{
|
||||
$handler = new IcingaObjectHandler($this->getRequest(), $this->getResponse(), $this->db());
|
||||
try {
|
||||
$this->loadOptionalObject();
|
||||
@ -86,7 +93,10 @@ abstract class ObjectController extends ActionController
|
||||
// different view renderers - hard exit is the only safe bet right
|
||||
// now.
|
||||
exit;
|
||||
} else {
|
||||
}
|
||||
|
||||
protected function initializeWebRequest()
|
||||
{
|
||||
$this->loadOptionalObject();
|
||||
if ($this->getRequest()->getActionName() === 'add') {
|
||||
$this->addSingleTab(
|
||||
@ -105,7 +115,6 @@ abstract class ObjectController extends ActionController
|
||||
$this->addDeploymentLink();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws NotFoundError
|
||||
|
Loading…
x
Reference in New Issue
Block a user