dependencies: cleanup

This commit is contained in:
Thomas Gelf 2018-06-08 08:45:54 +02:00
parent d2cfa20385
commit a95618f283
2 changed files with 50 additions and 13 deletions

View File

@ -10,10 +10,10 @@ class DependencyController extends ObjectController
{ {
protected $apply; protected $apply;
protected function beforeTabs() /**
{ * @throws \Icinga\Exception\ConfigurationError
} * @throws \Icinga\Exception\NotFoundError
*/
public function init() public function init()
{ {
parent::init(); parent::init();
@ -26,6 +26,12 @@ class DependencyController extends ObjectController
} }
} }
/**
* @return \Icinga\Module\Director\Objects\IcingaObject
* @throws \Icinga\Exception\ConfigurationError
* @throws \Icinga\Exception\InvalidPropertyException
* @throws \Icinga\Exception\NotFoundError
*/
protected function loadObject() protected function loadObject()
{ {
if ($this->object === null) { if ($this->object === null) {
@ -42,12 +48,11 @@ class DependencyController extends ObjectController
return $this->object; return $this->object;
} }
public function loadForm($name) /**
{ * Hint: this is never being called. Why?
$form = parent::loadForm($name); *
return $form; * @param $form
} */
protected function beforeHandlingAddRequest($form) protected function beforeHandlingAddRequest($form)
{ {
/** @var IcingaDependencyForm $form */ /** @var IcingaDependencyForm $form */

View File

@ -3,17 +3,21 @@
namespace Icinga\Module\Director\Forms; namespace Icinga\Module\Director\Forms;
use Icinga\Module\Director\Web\Form\DirectorObjectForm; use Icinga\Module\Director\Web\Form\DirectorObjectForm;
use Icinga\Module\Director\Objects\IcingaHost;
use Icinga\Module\Director\Objects\IcingaService;
use Icinga\Module\Director\Objects\IcingaDependency; use Icinga\Module\Director\Objects\IcingaDependency;
class IcingaDependencyForm extends DirectorObjectForm class IcingaDependencyForm extends DirectorObjectForm
{ {
/**
* @throws \Zend_Form_Exception
*/
public function setup() public function setup()
{ {
$this->setupDependencyElements(); $this->setupDependencyElements();
} }
/***
* @throws \Zend_Form_Exception
*/
protected function setupDependencyElements() protected function setupDependencyElements()
{ {
$this->addObjectTypeElement(); $this->addObjectTypeElement();
@ -35,6 +39,10 @@ class IcingaDependencyForm extends DirectorObjectForm
->setButtons(); ->setButtons();
} }
/**
* @return $this
* @throws \Zend_Form_Exception
*/
protected function addZoneSection() protected function addZoneSection()
{ {
$this->addZoneElement(true); $this->addZoneElement(true);
@ -55,6 +63,10 @@ class IcingaDependencyForm extends DirectorObjectForm
return $this; return $this;
} }
/**
* @return $this
* @throws \Zend_Form_Exception
*/
protected function addNameElement() protected function addNameElement()
{ {
$this->addElement('text', 'object_name', [ $this->addElement('text', 'object_name', [
@ -66,7 +78,10 @@ class IcingaDependencyForm extends DirectorObjectForm
return $this; return $this;
} }
/**
* @return $this
* @throws \Zend_Form_Exception
*/
protected function addAssignmentElements() protected function addAssignmentElements()
{ {
if (!$this->object || !$this->object->isApplyRule()) { if (!$this->object || !$this->object->isApplyRule()) {
@ -105,6 +120,10 @@ class IcingaDependencyForm extends DirectorObjectForm
return $this; return $this;
} }
/**
* @return $this
* @throws \Zend_Form_Exception
*/
protected function addPeriodElement() protected function addPeriodElement()
{ {
$periods = $this->db->enumTimeperiods(); $periods = $this->db->enumTimeperiods();
@ -128,6 +147,9 @@ class IcingaDependencyForm extends DirectorObjectForm
return $this; return $this;
} }
/**
* @return $this
*/
protected function addBooleanElements() protected function addBooleanElements()
{ {
$this->addBoolean('disable_checks', [ $this->addBoolean('disable_checks', [
@ -157,6 +179,10 @@ class IcingaDependencyForm extends DirectorObjectForm
return $this; return $this;
} }
/**
* @return $this
* @throws \Zend_Form_Exception
*/
protected function addObjectsElement() protected function addObjectsElement()
{ {
$this->addElement( $this->addElement(
@ -246,6 +272,12 @@ class IcingaDependencyForm extends DirectorObjectForm
return $this; return $this;
} }
/**
* Hint: this is unused. Why?
*
* @param IcingaDependency $dependency
* @return $this
*/
public function createApplyRuleFor(IcingaDependency $dependency) public function createApplyRuleFor(IcingaDependency $dependency)
{ {
$object = $this->object(); $object = $this->object();