fix: should be able to list entities with out sources

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-06-21 00:11:26 -04:00
parent 55e813d4bb
commit cee6c2924c
+13 -8
View File
@@ -499,18 +499,20 @@ class DefaultController extends ControllerAbstract {
// ==================== Entity Operations ==================== // ==================== Entity Operations ====================
private function entityListBulk(string $tenantId, string $userId, array $data): mixed { private function entityListBulk(string $tenantId, string $userId, array $data): mixed {
if (!isset($data['sources'])) {
throw new InvalidArgumentException(self::ERR_MISSING_SOURCES); if (isset($data['sources'])) {
}
if (!is_array($data['sources'])) { if (!is_array($data['sources'])) {
throw new InvalidArgumentException(self::ERR_INVALID_SOURCES); throw new InvalidArgumentException(self::ERR_INVALID_SOURCES);
} }
$sources = ResourceIdentifiers::fromArray($data['sources']); $sources = ResourceIdentifiers::fromArray($data['sources']);
foreach ($sources as $source) { foreach ($sources as $source) {
if (!$source instanceof EntityIdentifier) { if (!$source instanceof ServiceIdentifier && !$source instanceof CollectionIdentifier) {
throw new InvalidArgumentException('Invalid parameter: sources must contain provider:service:collection:entity identifiers'); throw new InvalidArgumentException('Invalid parameter: sources must contain provider:service or provider:service:collection identifiers');
} }
}
} else {
$sources = null;
} }
$filter = $data['filter'] ?? null; $filter = $data['filter'] ?? null;
@@ -522,9 +524,8 @@ class DefaultController extends ControllerAbstract {
} }
private function entityListStream(string $tenantId, string $userId, array $data, int $version, string $transaction): StreamedNdJsonResponse { private function entityListStream(string $tenantId, string $userId, array $data, int $version, string $transaction): StreamedNdJsonResponse {
if (!isset($data['sources'])) {
throw new InvalidArgumentException(self::ERR_MISSING_SOURCES); if (isset($data['sources'])) {
}
if (!is_array($data['sources'])) { if (!is_array($data['sources'])) {
throw new InvalidArgumentException(self::ERR_INVALID_SOURCES); throw new InvalidArgumentException(self::ERR_INVALID_SOURCES);
} }
@@ -535,6 +536,10 @@ class DefaultController extends ControllerAbstract {
throw new InvalidArgumentException('Invalid parameter: sources must contain provider:service or provider:service:collection identifiers'); throw new InvalidArgumentException('Invalid parameter: sources must contain provider:service or provider:service:collection identifiers');
} }
} }
} else {
$sources = null;
}
$filter = $data['filter'] ?? null; $filter = $data['filter'] ?? null;
$sort = $data['sort'] ?? null; $sort = $data['sort'] ?? null;