From 1a74c78215b68b5a8674cdf1d7172d1999617639 Mon Sep 17 00:00:00 2001 From: bbrands02 Date: Thu, 23 Apr 2026 11:57:51 +0000 Subject: [PATCH 1/9] feat: add ObjectServiceMapperAdapter Exposes a mapper-like API over ObjectService so external apps (e.g. OpenConnector) can interact with OpenRegister objects through a familiar contract without depending on ObjectService internals. Register and schema context are injected once at construction time. Co-Authored-By: Claude Sonnet 4.6 --- lib/Service/ObjectServiceMapperAdapter.php | 147 +++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 lib/Service/ObjectServiceMapperAdapter.php diff --git a/lib/Service/ObjectServiceMapperAdapter.php b/lib/Service/ObjectServiceMapperAdapter.php new file mode 100644 index 0000000000..279586af2f --- /dev/null +++ b/lib/Service/ObjectServiceMapperAdapter.php @@ -0,0 +1,147 @@ +objectService->find( + id: $identifier, + _extend: $extend ?? [], + register: $this->register, + schema: $this->schema + ); + } + + public function findByUuid(int|string $identifier): ?ObjectEntity + { + return $this->find(identifier: $identifier); + } + + public function findAll( + array $config = [], + ?array $filters = null, + ?array $ids = null, + ?int $limit = null, + ?int $offset = null, + ?array $sort = null, + ?array $extend = null, + ?string $search = null + ): array { + if ($filters !== null) { + $config['filters'] = $filters; + } + + if ($ids !== null) { + $config['ids'] = $ids; + } + + if ($limit !== null) { + $config['limit'] = $limit; + } + + if ($offset !== null) { + $config['offset'] = $offset; + } + + if ($sort !== null) { + $config['sort'] = $sort; + } + + if ($extend !== null) { + $config['extend'] = $extend; + } + + if ($search !== null) { + $config['search'] = $search; + } + + $config['filters'] ??= []; + + if ($this->register !== null && !isset($config['filters']['register'])) { + $config['filters']['register'] = $this->register; + } + + if ($this->schema !== null && !isset($config['filters']['schema'])) { + $config['filters']['schema'] = $this->schema; + } + + return $this->objectService->findAll(config: $config); + } + + public function createFromArray(array $object): ObjectEntity + { + return $this->objectService->saveObject( + object: $object, + register: $this->register, + schema: $this->schema + ); + } + + public function updateFromArray( + int|string $id, + array $object, + bool $validate = true, + bool $patch = false + ): ObjectEntity { + if ($patch === true) { + return $this->objectService->patchObject((string) $id, $object); + } + + return $this->objectService->updateObject((string) $id, $object); + } + + public function update(ObjectEntity $object): ObjectEntity + { + return $this->objectService->saveObject( + object: $object, + register: $this->register, + schema: $this->schema + ); + } + + public function delete(array $criteria): bool + { + $id = $criteria['id'] ?? null; + if ($id === null) { + throw new ValidationException('No id given to delete'); + } + + return $this->objectService->deleteObject((string) $id); + } + + public function getSchema(): ?int + { + return $this->schema !== null ? (int) $this->schema : null; + } + + public function getRegister(): ?int + { + return $this->register !== null ? (int) $this->register : null; + } + + public function getValidateHandler(): mixed + { + return $this->objectService->getValidateHandler(); + } +} From 3845962e009a39b3a8e10a731ed35dbaa7ab3172 Mon Sep 17 00:00:00 2001 From: bbrands02 Date: Thu, 23 Apr 2026 12:25:42 +0000 Subject: [PATCH 2/9] feat: add ObjectService::getMapper() and complete adapter API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wires up the ObjectServiceMapperAdapter so external apps can obtain an instance via ObjectService::getMapper(register, schema). Changes: - ObjectService::getMapper() — returns ObjectServiceMapperAdapter with injected register/schema context; non-numeric string arguments (e.g. 'objectEntity' type hints from OpenConnector) are treated as unconstrained and produce a register/schema-free adapter that searches globally - ObjectService::getValidateHandler() — exposes the internal validate handler - ObjectService::clearCurrents() — resets currentRegister/Schema/Object state - ObjectServiceMapperAdapter::findAllPaginated() — delegates to searchObjectsPaginated() and returns results/total/page/pages Co-Authored-By: Claude Sonnet 4.6 --- lib/Service/ObjectService.php | 30 ++++++++++++++++++++++ lib/Service/ObjectServiceMapperAdapter.php | 20 +++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/lib/Service/ObjectService.php b/lib/Service/ObjectService.php index 0f3b781cb7..782b663455 100644 --- a/lib/Service/ObjectService.php +++ b/lib/Service/ObjectService.php @@ -53,6 +53,7 @@ use OCA\OpenRegister\Service\Object\PermissionHandler; use OCA\OpenRegister\Service\Object\RenderObject; use OCA\OpenRegister\Service\Object\SaveObject; +use OCA\OpenRegister\Service\ObjectServiceMapperAdapter; use OCA\OpenRegister\Service\Object\SaveObjects; use OCA\OpenRegister\Service\Object\SearchQueryHandler; use OCA\OpenRegister\Service\Object\ValidateObject; @@ -3198,4 +3199,33 @@ public function validateAndSaveObjectsBySchema(int $registerId, int $schemaId, ? offset: $offset ); }//end validateAndSaveObjectsBySchema() + + public function clearCurrents(): void + { + $this->currentRegister = null; + $this->currentSchema = null; + $this->currentObject = null; + }//end clearCurrents() + + public function getValidateHandler(): ValidateObject + { + return $this->validateHandler; + }//end getValidateHandler() + + public function getMapper(int|string|null $register = null, int|string|null $schema = null): ObjectServiceMapperAdapter + { + // A non-numeric string (e.g. 'objectEntity') is a type-hint from the caller, not a register ID. + // Return an unconstrained adapter so find() searches across all registers/schemas. + if (is_string($register) === true && is_numeric($register) === false) { + $register = null; + $schema = null; + } + + return new ObjectServiceMapperAdapter( + objectService: $this, + register: $register, + schema: $schema + ); + }//end getMapper() + }//end class diff --git a/lib/Service/ObjectServiceMapperAdapter.php b/lib/Service/ObjectServiceMapperAdapter.php index 279586af2f..bb87092841 100644 --- a/lib/Service/ObjectServiceMapperAdapter.php +++ b/lib/Service/ObjectServiceMapperAdapter.php @@ -140,6 +140,26 @@ public function getRegister(): ?int return $this->register !== null ? (int) $this->register : null; } + public function findAllPaginated(array $requestParams = []): array + { + if ($this->register !== null && isset($requestParams['_register']) === false) { + $requestParams['_register'] = $this->register; + } + + if ($this->schema !== null && isset($requestParams['_schema']) === false) { + $requestParams['_schema'] = $this->schema; + } + + $result = $this->objectService->searchObjectsPaginated(query: $requestParams); + + return [ + 'results' => $result['results'] ?? [], + 'total' => $result['total'] ?? 0, + 'page' => $result['page'] ?? 1, + 'pages' => $result['pages'] ?? 1, + ]; + } + public function getValidateHandler(): mixed { return $this->objectService->getValidateHandler(); From 0f0984250324f6e42bf6a379b1fb89421513fca0 Mon Sep 17 00:00:00 2001 From: bbrands02 Date: Thu, 23 Apr 2026 12:29:03 +0000 Subject: [PATCH 3/9] docs: add docblocks to ObjectService and adapter added methods Co-Authored-By: Claude Sonnet 4.6 --- lib/Service/ObjectService.php | 29 ++++++++++++++++++++++ lib/Service/ObjectServiceMapperAdapter.php | 15 +++++++++++ 2 files changed, 44 insertions(+) diff --git a/lib/Service/ObjectService.php b/lib/Service/ObjectService.php index 782b663455..b3c36968de 100644 --- a/lib/Service/ObjectService.php +++ b/lib/Service/ObjectService.php @@ -3200,6 +3200,12 @@ public function validateAndSaveObjectsBySchema(int $registerId, int $schemaId, ? ); }//end validateAndSaveObjectsBySchema() + /** + * Reset the current register, schema, and object context. + * + * Called by external apps (e.g. OpenConnector) before performing a fresh + * lookup to prevent stale context from a previous request bleeding through. + */ public function clearCurrents(): void { $this->currentRegister = null; @@ -3207,11 +3213,34 @@ public function clearCurrents(): void $this->currentObject = null; }//end clearCurrents() + /** + * Return the internal object-validation handler. + * + * Exposed so adapters and external services can run validation without + * depending on ObjectService internals directly. + * + * @return ValidateObject + */ public function getValidateHandler(): ValidateObject { return $this->validateHandler; }//end getValidateHandler() + /** + * Return a mapper-like adapter scoped to the given register and schema. + * + * Allows external apps to interact with OpenRegister objects through a + * familiar mapper contract without depending on ObjectService internals. + * + * When $register is a non-numeric string (e.g. the type hint 'objectEntity' + * passed by OpenConnector), it is treated as an unscoped request and both + * register and schema are set to null so the adapter searches globally. + * + * @param int|string|null $register Register ID, or a type-hint string that is ignored. + * @param int|string|null $schema Schema ID. + * + * @return ObjectServiceMapperAdapter + */ public function getMapper(int|string|null $register = null, int|string|null $schema = null): ObjectServiceMapperAdapter { // A non-numeric string (e.g. 'objectEntity') is a type-hint from the caller, not a register ID. diff --git a/lib/Service/ObjectServiceMapperAdapter.php b/lib/Service/ObjectServiceMapperAdapter.php index bb87092841..1b0cca95ac 100644 --- a/lib/Service/ObjectServiceMapperAdapter.php +++ b/lib/Service/ObjectServiceMapperAdapter.php @@ -140,6 +140,16 @@ public function getRegister(): ?int return $this->register !== null ? (int) $this->register : null; } + /** + * Return a paginated list of objects matching the given request parameters. + * + * Injects the adapter's register and schema into the query when not already + * present, then delegates to ObjectService::searchObjectsPaginated(). + * + * @param array $requestParams Raw query parameters (limit, page, filters, etc.). + * + * @return array{results: array, total: int, page: int, pages: int} + */ public function findAllPaginated(array $requestParams = []): array { if ($this->register !== null && isset($requestParams['_register']) === false) { @@ -160,6 +170,11 @@ public function findAllPaginated(array $requestParams = []): array ]; } + /** + * Return the object-validation handler from the underlying ObjectService. + * + * @return mixed + */ public function getValidateHandler(): mixed { return $this->objectService->getValidateHandler(); From f464ac85692e424ce66e31692dd6ee5232f4eac9 Mon Sep 17 00:00:00 2001 From: bbrands02 Date: Thu, 23 Apr 2026 12:32:28 +0000 Subject: [PATCH 4/9] docs: add docblocks to all adapter methods Also narrows getValidateHandler() return type from mixed to ValidateObject and adds the ValidateObject use statement. Co-Authored-By: Claude Sonnet 4.6 --- lib/Service/ObjectServiceMapperAdapter.php | 104 ++++++++++++++++++++- 1 file changed, 99 insertions(+), 5 deletions(-) diff --git a/lib/Service/ObjectServiceMapperAdapter.php b/lib/Service/ObjectServiceMapperAdapter.php index 1b0cca95ac..e31f84023c 100644 --- a/lib/Service/ObjectServiceMapperAdapter.php +++ b/lib/Service/ObjectServiceMapperAdapter.php @@ -6,6 +6,7 @@ use OCA\OpenRegister\Db\ObjectEntity; use OCA\OpenRegister\Exception\ValidationException; +use OCA\OpenRegister\Service\Object\ValidateObject; /** * Adapter that exposes a mapper-like API over ObjectService. @@ -23,6 +24,14 @@ public function __construct( ) { } + /** + * Find a single object by its ID or UUID. + * + * @param int|string $identifier Object ID or UUID. + * @param array|null $extend Relations to expand inline. + * + * @return ObjectEntity|null + */ public function find(int|string $identifier, ?array $extend = null): ?ObjectEntity { return $this->objectService->find( @@ -33,11 +42,38 @@ public function find(int|string $identifier, ?array $extend = null): ?ObjectEnti ); } + /** + * Alias of find() for interface compatibility with QBMapper-based mappers. + * + * @param int|string $identifier Object UUID. + * + * @return ObjectEntity|null + */ public function findByUuid(int|string $identifier): ?ObjectEntity { return $this->find(identifier: $identifier); } + /** + * Return a list of objects matching the given criteria. + * + * The adapter's register and schema are injected into $config['filters'] + * automatically unless already set by the caller. Context is passed via + * the $config['filters']['register'] and $config['filters']['schema'] keys — + * distinct from the _register/_schema underscore-prefixed keys used by + * findAllPaginated(). + * + * @param array $config Full config array (filters, limit, offset, sort, extend, search, ids). + * @param array|null $filters Shorthand filter map; merged into $config['filters']. + * @param array|null $ids Restrict results to these object IDs. + * @param int|null $limit Maximum number of results. + * @param int|null $offset Number of results to skip. + * @param array|null $sort Sort specification. + * @param array|null $extend Relations to expand inline. + * @param string|null $search Full-text search term. + * + * @return array + */ public function findAll( array $config = [], ?array $filters = null, @@ -89,6 +125,15 @@ public function findAll( return $this->objectService->findAll(config: $config); } + /** + * Create a new object from a plain data array. + * + * The adapter's register and schema are applied automatically. + * + * @param array $object Raw object data. + * + * @return ObjectEntity + */ public function createFromArray(array $object): ObjectEntity { return $this->objectService->saveObject( @@ -98,6 +143,22 @@ public function createFromArray(array $object): ObjectEntity ); } + /** + * Update an existing object from a plain data array. + * + * When $patch is true, only the supplied fields are changed (PATCH semantics). + * When false, the object is fully replaced (PUT semantics). + * + * Note: the $validate parameter is accepted for interface compatibility but + * validation is always performed by the underlying ObjectService. + * + * @param int|string $id Object ID or UUID. + * @param array $object New object data. + * @param bool $validate Accepted for interface compatibility; has no effect. + * @param bool $patch When true, perform a partial update (PATCH). + * + * @return ObjectEntity + */ public function updateFromArray( int|string $id, array $object, @@ -111,6 +172,16 @@ public function updateFromArray( return $this->objectService->updateObject((string) $id, $object); } + /** + * Persist an already-hydrated ObjectEntity. + * + * The adapter's register and schema are applied; if the entity already + * belongs to a different register/schema this will override that context. + * + * @param ObjectEntity $object The entity to save. + * + * @return ObjectEntity + */ public function update(ObjectEntity $object): ObjectEntity { return $this->objectService->saveObject( @@ -120,6 +191,17 @@ public function update(ObjectEntity $object): ObjectEntity ); } + /** + * Delete an object by criteria array. + * + * The array must contain an 'id' key with the object ID or UUID. + * + * @param array $criteria Must contain key 'id' with the object ID or UUID. + * + * @return bool + * + * @throws ValidationException When no 'id' key is present in $criteria. + */ public function delete(array $criteria): bool { $id = $criteria['id'] ?? null; @@ -130,11 +212,21 @@ public function delete(array $criteria): bool return $this->objectService->deleteObject((string) $id); } + /** + * Return the schema ID this adapter is scoped to, or null for unconstrained. + * + * @return int|null + */ public function getSchema(): ?int { return $this->schema !== null ? (int) $this->schema : null; } + /** + * Return the register ID this adapter is scoped to, or null for unconstrained. + * + * @return int|null + */ public function getRegister(): ?int { return $this->register !== null ? (int) $this->register : null; @@ -143,10 +235,12 @@ public function getRegister(): ?int /** * Return a paginated list of objects matching the given request parameters. * - * Injects the adapter's register and schema into the query when not already - * present, then delegates to ObjectService::searchObjectsPaginated(). + * Injects the adapter's register and schema into the query using the + * underscore-prefixed keys (_register, _schema) expected by + * ObjectService::searchObjectsPaginated() — distinct from the dot-notation + * keys used by findAll(). * - * @param array $requestParams Raw query parameters (limit, page, filters, etc.). + * @param array $requestParams Raw query parameters (e.g. _limit, page, _search). * * @return array{results: array, total: int, page: int, pages: int} */ @@ -173,9 +267,9 @@ public function findAllPaginated(array $requestParams = []): array /** * Return the object-validation handler from the underlying ObjectService. * - * @return mixed + * @return ValidateObject */ - public function getValidateHandler(): mixed + public function getValidateHandler(): ValidateObject { return $this->objectService->getValidateHandler(); } From 223f20dae942cbae68e422d15181045c60e55075 Mon Sep 17 00:00:00 2001 From: bbrands02 Date: Thu, 23 Apr 2026 12:37:56 +0000 Subject: [PATCH 5/9] fix: route updateFromArray through saveObject with register/schema context patchObject() cast the UUID to int via (int) $objectId, breaking PATCH for UUID-identified objects. updateObject() called saveObject() without the adapter's register/schema context, targeting the wrong table for PUT. Both paths now go through saveObject() directly: - PATCH: fetches existing object via find() (UUID-safe), merges partial data - PUT: passes full data with id set, register and schema injected Co-Authored-By: Claude Sonnet 4.6 --- lib/Service/ObjectServiceMapperAdapter.php | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/Service/ObjectServiceMapperAdapter.php b/lib/Service/ObjectServiceMapperAdapter.php index e31f84023c..ed8c5c9b7a 100644 --- a/lib/Service/ObjectServiceMapperAdapter.php +++ b/lib/Service/ObjectServiceMapperAdapter.php @@ -146,14 +146,18 @@ public function createFromArray(array $object): ObjectEntity /** * Update an existing object from a plain data array. * - * When $patch is true, only the supplied fields are changed (PATCH semantics). - * When false, the object is fully replaced (PUT semantics). + * When $patch is true, only the supplied fields are changed (PATCH semantics): + * the existing object is fetched, the incoming fields are merged on top, and + * the result is saved. When false, the full object is replaced (PUT semantics). + * + * Both paths route through saveObject() with the adapter's register/schema + * context so the correct dynamic table is targeted. * * Note: the $validate parameter is accepted for interface compatibility but * validation is always performed by the underlying ObjectService. * * @param int|string $id Object ID or UUID. - * @param array $object New object data. + * @param array $object New or partial object data. * @param bool $validate Accepted for interface compatibility; has no effect. * @param bool $patch When true, perform a partial update (PATCH). * @@ -166,10 +170,19 @@ public function updateFromArray( bool $patch = false ): ObjectEntity { if ($patch === true) { - return $this->objectService->patchObject((string) $id, $object); + $existing = $this->objectService->find( + id: (string) $id, + register: $this->register, + schema: $this->schema + ); + $object = array_merge($existing->getObject(), $object); } - return $this->objectService->updateObject((string) $id, $object); + return $this->objectService->saveObject( + object: array_merge($object, ['id' => (string) $id]), + register: $this->register, + schema: $this->schema + ); } /** From 21ab6c6a8c58d16019b655164db66fce485edb1b Mon Sep 17 00:00:00 2001 From: bbrands02 Date: Thu, 23 Apr 2026 12:48:59 +0000 Subject: [PATCH 6/9] refactor: remove findByUuid from ObjectServiceMapperAdapter find() already accepts both IDs and UUIDs. findByUuid was a pure alias with no additional behaviour, kept only for interface compatibility. OpenConnector's EndpointService now calls find() directly. Co-Authored-By: Claude Sonnet 4.6 --- lib/Service/ObjectServiceMapperAdapter.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib/Service/ObjectServiceMapperAdapter.php b/lib/Service/ObjectServiceMapperAdapter.php index ed8c5c9b7a..c9feaa8db0 100644 --- a/lib/Service/ObjectServiceMapperAdapter.php +++ b/lib/Service/ObjectServiceMapperAdapter.php @@ -42,18 +42,6 @@ public function find(int|string $identifier, ?array $extend = null): ?ObjectEnti ); } - /** - * Alias of find() for interface compatibility with QBMapper-based mappers. - * - * @param int|string $identifier Object UUID. - * - * @return ObjectEntity|null - */ - public function findByUuid(int|string $identifier): ?ObjectEntity - { - return $this->find(identifier: $identifier); - } - /** * Return a list of objects matching the given criteria. * From ed781ff1ceb9977312ae306340a7ca0dfe90495f Mon Sep 17 00:00:00 2001 From: bbrands02 Date: Thu, 23 Apr 2026 13:15:22 +0000 Subject: [PATCH 7/9] fix: resolve all PHPCS violations in adapter and ObjectService additions - Add file docblock, constructor docblock, //end markers - Remove spaces around = in default argument values - Replace ! operator with === false - Use named parameter for ValidationException constructor - Fix ?? alignment spacing - Add @return void to clearCurrents() - Remove spaces around = in getMapper() signature Co-Authored-By: Claude Sonnet 4.6 --- lib/Service/ObjectService.php | 4 +- lib/Service/ObjectServiceMapperAdapter.php | 81 +++++++++++++--------- 2 files changed, 51 insertions(+), 34 deletions(-) diff --git a/lib/Service/ObjectService.php b/lib/Service/ObjectService.php index b3c36968de..8f0a7e98eb 100644 --- a/lib/Service/ObjectService.php +++ b/lib/Service/ObjectService.php @@ -3205,6 +3205,8 @@ public function validateAndSaveObjectsBySchema(int $registerId, int $schemaId, ? * * Called by external apps (e.g. OpenConnector) before performing a fresh * lookup to prevent stale context from a previous request bleeding through. + * + * @return void */ public function clearCurrents(): void { @@ -3241,7 +3243,7 @@ public function getValidateHandler(): ValidateObject * * @return ObjectServiceMapperAdapter */ - public function getMapper(int|string|null $register = null, int|string|null $schema = null): ObjectServiceMapperAdapter + public function getMapper(int|string|null $register=null, int|string|null $schema=null): ObjectServiceMapperAdapter { // A non-numeric string (e.g. 'objectEntity') is a type-hint from the caller, not a register ID. // Return an unconstrained adapter so find() searches across all registers/schemas. diff --git a/lib/Service/ObjectServiceMapperAdapter.php b/lib/Service/ObjectServiceMapperAdapter.php index c9feaa8db0..d391301002 100644 --- a/lib/Service/ObjectServiceMapperAdapter.php +++ b/lib/Service/ObjectServiceMapperAdapter.php @@ -1,4 +1,10 @@ objectService->find( id: $identifier, @@ -40,7 +54,7 @@ public function find(int|string $identifier, ?array $extend = null): ?ObjectEnti register: $this->register, schema: $this->schema ); - } + }//end find() /** * Return a list of objects matching the given criteria. @@ -63,14 +77,14 @@ public function find(int|string $identifier, ?array $extend = null): ?ObjectEnti * @return array */ public function findAll( - array $config = [], - ?array $filters = null, - ?array $ids = null, - ?int $limit = null, - ?int $offset = null, - ?array $sort = null, - ?array $extend = null, - ?string $search = null + array $config=[], + ?array $filters=null, + ?array $ids=null, + ?int $limit=null, + ?int $offset=null, + ?array $sort=null, + ?array $extend=null, + ?string $search=null ): array { if ($filters !== null) { $config['filters'] = $filters; @@ -102,16 +116,16 @@ public function findAll( $config['filters'] ??= []; - if ($this->register !== null && !isset($config['filters']['register'])) { + if ($this->register !== null && isset($config['filters']['register']) === false) { $config['filters']['register'] = $this->register; } - if ($this->schema !== null && !isset($config['filters']['schema'])) { + if ($this->schema !== null && isset($config['filters']['schema']) === false) { $config['filters']['schema'] = $this->schema; } return $this->objectService->findAll(config: $config); - } + }//end findAll() /** * Create a new object from a plain data array. @@ -129,7 +143,7 @@ public function createFromArray(array $object): ObjectEntity register: $this->register, schema: $this->schema ); - } + }//end createFromArray() /** * Update an existing object from a plain data array. @@ -154,8 +168,8 @@ public function createFromArray(array $object): ObjectEntity public function updateFromArray( int|string $id, array $object, - bool $validate = true, - bool $patch = false + bool $validate=true, + bool $patch=false ): ObjectEntity { if ($patch === true) { $existing = $this->objectService->find( @@ -163,7 +177,7 @@ public function updateFromArray( register: $this->register, schema: $this->schema ); - $object = array_merge($existing->getObject(), $object); + $object = array_merge($existing->getObject(), $object); } return $this->objectService->saveObject( @@ -171,7 +185,7 @@ public function updateFromArray( register: $this->register, schema: $this->schema ); - } + }//end updateFromArray() /** * Persist an already-hydrated ObjectEntity. @@ -190,7 +204,7 @@ public function update(ObjectEntity $object): ObjectEntity register: $this->register, schema: $this->schema ); - } + }//end update() /** * Delete an object by criteria array. @@ -207,11 +221,11 @@ public function delete(array $criteria): bool { $id = $criteria['id'] ?? null; if ($id === null) { - throw new ValidationException('No id given to delete'); + throw new ValidationException(message: 'No id given to delete'); } return $this->objectService->deleteObject((string) $id); - } + }//end delete() /** * Return the schema ID this adapter is scoped to, or null for unconstrained. @@ -221,7 +235,7 @@ public function delete(array $criteria): bool public function getSchema(): ?int { return $this->schema !== null ? (int) $this->schema : null; - } + }//end getSchema() /** * Return the register ID this adapter is scoped to, or null for unconstrained. @@ -231,7 +245,7 @@ public function getSchema(): ?int public function getRegister(): ?int { return $this->register !== null ? (int) $this->register : null; - } + }//end getRegister() /** * Return a paginated list of objects matching the given request parameters. @@ -245,7 +259,7 @@ public function getRegister(): ?int * * @return array{results: array, total: int, page: int, pages: int} */ - public function findAllPaginated(array $requestParams = []): array + public function findAllPaginated(array $requestParams=[]): array { if ($this->register !== null && isset($requestParams['_register']) === false) { $requestParams['_register'] = $this->register; @@ -259,11 +273,11 @@ public function findAllPaginated(array $requestParams = []): array return [ 'results' => $result['results'] ?? [], - 'total' => $result['total'] ?? 0, - 'page' => $result['page'] ?? 1, - 'pages' => $result['pages'] ?? 1, + 'total' => $result['total'] ?? 0, + 'page' => $result['page'] ?? 1, + 'pages' => $result['pages'] ?? 1, ]; - } + }//end findAllPaginated() /** * Return the object-validation handler from the underlying ObjectService. @@ -273,5 +287,6 @@ public function findAllPaginated(array $requestParams = []): array public function getValidateHandler(): ValidateObject { return $this->objectService->getValidateHandler(); - } -} + }//end getValidateHandler() + +}//end class From 8ccc866f0710b225dcecc983b143d438f532d438 Mon Sep 17 00:00:00 2001 From: bbrands02 Date: Thu, 23 Apr 2026 13:19:25 +0000 Subject: [PATCH 8/9] fix: resolve remaining PHPCS violations - Add @author and @license to file comment - Fix constructor docblock param type alignment - Remove blank line after class opening brace - Remove trailing blank lines before }//end class in both files Co-Authored-By: Claude Sonnet 4.6 --- lib/Service/ObjectService.php | 1 - lib/Service/ObjectServiceMapperAdapter.php | 12 +++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/Service/ObjectService.php b/lib/Service/ObjectService.php index 8f0a7e98eb..d0488e48a2 100644 --- a/lib/Service/ObjectService.php +++ b/lib/Service/ObjectService.php @@ -3258,5 +3258,4 @@ public function getMapper(int|string|null $register=null, int|string|null $schem schema: $schema ); }//end getMapper() - }//end class diff --git a/lib/Service/ObjectServiceMapperAdapter.php b/lib/Service/ObjectServiceMapperAdapter.php index d391301002..c6b8408940 100644 --- a/lib/Service/ObjectServiceMapperAdapter.php +++ b/lib/Service/ObjectServiceMapperAdapter.php @@ -2,6 +2,10 @@ /** * Adapter that exposes a mapper-like API over ObjectService. * + * @author Conduction Development Team + * @copyright 2024 Conduction B.V. + * @license EUPL-1.2 https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 + * * @category Service * @package OCA\OpenRegister\Service */ @@ -23,13 +27,12 @@ */ class ObjectServiceMapperAdapter { - /** * Constructor. * - * @param ObjectService $objectService The underlying object service. - * @param int|string|null $register Register ID to scope all calls to. - * @param int|string|null $schema Schema ID to scope all calls to. + * @param ObjectService $objectService The underlying object service. + * @param int|string|null $register Register ID to scope all calls to. + * @param int|string|null $schema Schema ID to scope all calls to. */ public function __construct( private readonly ObjectService $objectService, @@ -288,5 +291,4 @@ public function getValidateHandler(): ValidateObject { return $this->objectService->getValidateHandler(); }//end getValidateHandler() - }//end class From b89d0da016eebf37bb50dbef96f9d67214544546 Mon Sep 17 00:00:00 2001 From: bbrands02 Date: Thu, 23 Apr 2026 13:23:53 +0000 Subject: [PATCH 9/9] fix: correct file comment tag order to satisfy PHPCS Co-Authored-By: Claude Sonnet 4.6 --- lib/Service/ObjectServiceMapperAdapter.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/Service/ObjectServiceMapperAdapter.php b/lib/Service/ObjectServiceMapperAdapter.php index c6b8408940..6873b852cf 100644 --- a/lib/Service/ObjectServiceMapperAdapter.php +++ b/lib/Service/ObjectServiceMapperAdapter.php @@ -2,12 +2,11 @@ /** * Adapter that exposes a mapper-like API over ObjectService. * + * @category Service + * @package OCA\OpenRegister\Service * @author Conduction Development Team * @copyright 2024 Conduction B.V. * @license EUPL-1.2 https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 - * - * @category Service - * @package OCA\OpenRegister\Service */ declare(strict_types=1);