refactor: service interface changes

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-03-06 22:54:54 -05:00
parent 0cc5a8f0d4
commit 35615bedb7

View File

@@ -192,7 +192,7 @@ class PersonalService implements ServiceBaseInterface, ServiceCollectionMutableI
return new Sort($this->serviceAbilities[self::CAPABILITY_COLLECTION_LIST_SORT] ?? []); return new Sort($this->serviceAbilities[self::CAPABILITY_COLLECTION_LIST_SORT] ?? []);
} }
public function collectionExtant(string|int $location, string|int ...$identifiers): array { public function collectionExtant(string|int|null $location, string|int ...$identifiers): array {
$cached = []; $cached = [];
$toCheck = []; $toCheck = [];
foreach ($identifiers as $id) { foreach ($identifiers as $id) {
@@ -209,7 +209,7 @@ class PersonalService implements ServiceBaseInterface, ServiceCollectionMutableI
return array_merge($cached, $fromStore); return array_merge($cached, $fromStore);
} }
public function collectionFetch(string|int $identifier): ?CollectionResource { public function collectionFetch(string|int|null $identifier): ?CollectionResource {
// null is root // null is root
if ($identifier === null) { if ($identifier === null) {
$identifier = self::ROOT_ID; $identifier = self::ROOT_ID;
@@ -433,7 +433,7 @@ class PersonalService implements ServiceBaseInterface, ServiceCollectionMutableI
return $entity; return $entity;
} }
public function entityCreate(string|int $collection, EntityMutableInterface $entity, array $options = []): EntityResource { public function entityCreate(string|int|null $collection, EntityMutableInterface $entity, array $options = []): EntityResource {
// null collection is root // null collection is root
if ($collection === null) { if ($collection === null) {
$collection = self::ROOT_ID; $collection = self::ROOT_ID;
@@ -467,7 +467,7 @@ class PersonalService implements ServiceBaseInterface, ServiceCollectionMutableI
return $result; return $result;
} }
public function entityDelete(string|int $collection, string|int $identifier): EntityResource { public function entityDelete(string|int|null $collection, string|int $identifier): EntityResource {
// null collection is root // null collection is root
if ($collection === null) { if ($collection === null) {
$collection = self::ROOT_ID; $collection = self::ROOT_ID;
@@ -493,7 +493,7 @@ class PersonalService implements ServiceBaseInterface, ServiceCollectionMutableI
return $entity; return $entity;
} }
public function entityDelta(string|int $collection, string $signature, string $detail = 'ids'): Delta { public function entityDelta(string|int|null $collection, string $signature, string $detail = 'ids'): Delta {
// null collection is root // null collection is root
if ($collection === null) { if ($collection === null) {
$collection = self::ROOT_ID; $collection = self::ROOT_ID;