From f66ab8dae2f3d0418759f81a3a64dc9517a62449 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 15:17:31 +0200 Subject: Adding upstream version 1.10.2. Signed-off-by: Daniel Baumann --- application/controllers/DependencyController.php | 63 ++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 application/controllers/DependencyController.php (limited to 'application/controllers/DependencyController.php') diff --git a/application/controllers/DependencyController.php b/application/controllers/DependencyController.php new file mode 100644 index 0000000..9d21cd5 --- /dev/null +++ b/application/controllers/DependencyController.php @@ -0,0 +1,63 @@ +params->get('apply')) { + $this->apply = IcingaDependency::load( + array('object_name' => $apply, 'object_type' => 'template'), + $this->db() + ); + } + } + + /** + * @return \Icinga\Module\Director\Objects\IcingaObject + * @throws \Icinga\Exception\ConfigurationError + * @throws \Icinga\Exception\InvalidPropertyException + * @throws \Icinga\Exception\NotFoundError + */ + protected function loadObject() + { + if ($this->object === null) { + if ($name = $this->params->get('name')) { + $params = array('object_name' => $name); + $db = $this->db(); + + $this->object = IcingaDependency::load($params, $db); + } else { + parent::loadObject(); + } + } + + return $this->object; + } + + /** + * Hint: this is never being called. Why? + * + * @param $form + */ + protected function beforeHandlingAddRequest($form) + { + /** @var IcingaDependencyForm $form */ + if ($this->apply) { + $form->createApplyRuleFor($this->apply); + } + } +} -- cgit v1.2.3