summaryrefslogtreecommitdiffstats
path: root/application/forms/Command/Object/ScheduleHostDowntimeForm.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/forms/Command/Object/ScheduleHostDowntimeForm.php')
-rw-r--r--application/forms/Command/Object/ScheduleHostDowntimeForm.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/application/forms/Command/Object/ScheduleHostDowntimeForm.php b/application/forms/Command/Object/ScheduleHostDowntimeForm.php
index bc21114..a09b00d 100644
--- a/application/forms/Command/Object/ScheduleHostDowntimeForm.php
+++ b/application/forms/Command/Object/ScheduleHostDowntimeForm.php
@@ -4,13 +4,16 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
+use CallbackFilterIterator;
use DateInterval;
use DateTime;
use Icinga\Application\Config;
use Icinga\Module\Icingadb\Command\Object\PropagateHostDowntimeCommand;
use Icinga\Module\Icingadb\Command\Object\ScheduleHostDowntimeCommand;
use Icinga\Web\Notification;
+use ipl\Orm\Model;
use ipl\Web\FormDecorator\IcingaFormDecorator;
+use Iterator;
use Traversable;
class ScheduleHostDowntimeForm extends ScheduleServiceDowntimeForm
@@ -87,10 +90,13 @@ class ScheduleHostDowntimeForm extends ScheduleServiceDowntimeForm
$decorator->decorate($this->getElement('child_options'));
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
- $granted = $this->filterGrantedOn('icingadb/command/downtime/schedule', $objects);
+ $granted = new CallbackFilterIterator($objects, function (Model $object): bool {
+ return $this->isGrantedOn('icingadb/command/downtime/schedule', $object);
+ });
+ $granted->rewind(); // Forwards the pointer to the first element
if ($granted->valid()) {
if (($childOptions = (int) $this->getValue('child_options'))) {
$command = new PropagateHostDowntimeCommand();