summaryrefslogtreecommitdiffstats
path: root/application/forms/Command/Object/ScheduleServiceDowntimeForm.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--application/forms/Command/Object/ScheduleServiceDowntimeForm.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/application/forms/Command/Object/ScheduleServiceDowntimeForm.php b/application/forms/Command/Object/ScheduleServiceDowntimeForm.php
index 184a4e8..b237408 100644
--- a/application/forms/Command/Object/ScheduleServiceDowntimeForm.php
+++ b/application/forms/Command/Object/ScheduleServiceDowntimeForm.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
+use CallbackFilterIterator;
use DateInterval;
use DateTime;
use Icinga\Application\Config;
@@ -13,9 +14,11 @@ use Icinga\Web\Notification;
use ipl\Html\Attributes;
use ipl\Html\HtmlElement;
use ipl\Html\Text;
+use ipl\Orm\Model;
use ipl\Validator\CallbackValidator;
use ipl\Web\FormDecorator\IcingaFormDecorator;
use ipl\Web\Widget\Icon;
+use Iterator;
use Traversable;
class ScheduleServiceDowntimeForm extends CommandForm
@@ -242,10 +245,13 @@ class ScheduleServiceDowntimeForm extends CommandForm
(new IcingaFormDecorator())->decorate($this->getElement('btn_submit'));
}
- 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()) {
$command = new ScheduleServiceDowntimeCommand();
$command->setObjects($granted);