summaryrefslogtreecommitdiffstats
path: root/library/Icingadb/Command/Object/ObjectsCommand.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:45:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:45:00 +0000
commitbe4626482ba8761da39746a6ac60d133d3852a0f (patch)
tree45065832c85c4789237e94b3114360eac91d86f0 /library/Icingadb/Command/Object/ObjectsCommand.php
parentReleasing progress-linux version 1.1.1-1~progress7.99u1. (diff)
downloadicingadb-web-be4626482ba8761da39746a6ac60d133d3852a0f.tar.xz
icingadb-web-be4626482ba8761da39746a6ac60d133d3852a0f.zip
Merging upstream version 1.1.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/Icingadb/Command/Object/ObjectsCommand.php')
-rw-r--r--library/Icingadb/Command/Object/ObjectsCommand.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/library/Icingadb/Command/Object/ObjectsCommand.php b/library/Icingadb/Command/Object/ObjectsCommand.php
index 3de6c83..f1a50d7 100644
--- a/library/Icingadb/Command/Object/ObjectsCommand.php
+++ b/library/Icingadb/Command/Object/ObjectsCommand.php
@@ -5,8 +5,11 @@
namespace Icinga\Module\Icingadb\Command\Object;
use ArrayIterator;
+use Generator;
use Icinga\Module\Icingadb\Command\IcingaCommand;
+use InvalidArgumentException;
use ipl\Orm\Model;
+use LogicException;
use Traversable;
/**
@@ -24,12 +27,18 @@ abstract class ObjectsCommand extends IcingaCommand
/**
* Set the involved objects
*
- * @param Traversable<Model> $objects
+ * @param Traversable<Model> $objects Except generators
*
* @return $this
+ *
+ * @throws InvalidArgumentException If a generator is passed
*/
public function setObjects(Traversable $objects): self
{
+ if ($objects instanceof Generator) {
+ throw new InvalidArgumentException('Generators are not supported');
+ }
+
$this->objects = $objects;
return $this;
@@ -57,7 +66,7 @@ abstract class ObjectsCommand extends IcingaCommand
public function getObjects(): Traversable
{
if ($this->objects === null) {
- throw new \LogicException(
+ throw new LogicException(
'You are accessing an unset property. Please make sure to set it beforehand.'
);
}