feat: add ObjectServiceMapperAdapter#1335
Conversation
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 <noreply@anthropic.com>
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| composer | ✅ | ✅ 147/147 | |||
| npm | ✅ | ✅ 599/599 | |||
| PHPUnit | ⏭️ | ||||
| Newman | ⏭️ | ||||
| Playwright | ⏭️ |
Quality workflow — 2026-04-23 12:07 UTC
Download the full PDF report from the workflow artifacts.
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 <noreply@anthropic.com>
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| composer | ✅ | ✅ 147/147 | |||
| npm | ✅ | ✅ 599/599 | |||
| PHPUnit | ⏭️ | ||||
| Newman | ⏭️ | ||||
| Playwright | ⏭️ |
Quality workflow — 2026-04-23 12:28 UTC
Download the full PDF report from the workflow artifacts.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| composer | ✅ | ✅ 147/147 | |||
| npm | ✅ | ✅ 599/599 | |||
| PHPUnit | ⏭️ | ||||
| Newman | ⏭️ | ||||
| Playwright | ⏭️ |
Quality workflow — 2026-04-23 12:31 UTC
Download the full PDF report from the workflow artifacts.
Also narrows getValidateHandler() return type from mixed to ValidateObject and adds the ValidateObject use statement. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| composer | ✅ | ✅ 147/147 | |||
| npm | ✅ | ✅ 599/599 | |||
| PHPUnit | ⏭️ | ||||
| Newman | ⏭️ | ||||
| Playwright | ⏭️ |
Quality workflow — 2026-04-23 12:34 UTC
Download the full PDF report from the workflow artifacts.
…ntext 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 <noreply@anthropic.com>
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| composer | ✅ | ✅ 147/147 | |||
| npm | ✅ | ✅ 599/599 | |||
| PHPUnit | ⏭️ | ||||
| Newman | ⏭️ | ||||
| Playwright | ⏭️ |
Quality workflow — 2026-04-23 12:40 UTC
Download the full PDF report from the workflow artifacts.
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 <noreply@anthropic.com>
rjzondervan
left a comment
There was a problem hiding this comment.
One question about setting a deprecation message.
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| composer | ✅ | ✅ 147/147 | |||
| npm | ✅ | ✅ 599/599 | |||
| PHPUnit | ⏭️ | ||||
| Newman | ⏭️ | ||||
| Playwright | ⏭️ |
Quality workflow — 2026-04-23 13:07 UTC
Download the full PDF report from the workflow artifacts.
- 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 <noreply@anthropic.com>
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| composer | ✅ | ✅ 147/147 | |||
| npm | ✅ | ✅ 599/599 | |||
| PHPUnit | ⏭️ | ||||
| Newman | ⏭️ | ||||
| Playwright | ⏭️ |
Quality workflow — 2026-04-23 13:17 UTC
Download the full PDF report from the workflow artifacts.
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| composer | ✅ | ✅ 147/147 | |||
| npm | ✅ | ✅ 599/599 | |||
| PHPUnit | ⏭️ | ||||
| Newman | ⏭️ | ||||
| Playwright | ⏭️ |
Quality workflow — 2026-04-23 13:22 UTC
Download the full PDF report from the workflow artifacts.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ✅ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| composer | ✅ | ✅ 147/147 | |||
| npm | ✅ | ✅ 599/599 | |||
| PHPUnit | ❌ | ||||
| Newman | ❌ | ||||
| Playwright | ⏭️ |
Quality workflow — 2026-04-23 13:27 UTC
Download the full PDF report from the workflow artifacts.
|
At $existing = $this->objectService->find(
id: (string) $id,
register: $this->register,
schema: $this->schema
);
$object = array_merge($existing->getObject(), $object);
|
|
Unscoped adapters (
if ($register !== null) { $this->setRegister(register: $register); }
if ($schema !== null) { $this->setSchema(schema: $schema); }The adapter's You added |
|
Minor doc hygiene: the PR description lists Current adapter surface only has |
|
return $this->schema !== null ? (int) $this->schema : null;A UUID string would collapse to |
|
return $this->objectService->deleteObject((string) $id);For an unscoped adapter that's fine, but a scoped adapter arguably shouldn't be able to delete objects that live outside its register/schema — it breaks the "scoped" contract every other method on the adapter upholds. Worth either tightening the check (find-then-verify-scope-then-delete) or documenting the exception. |
|
API consistency: the two list methods in
$config['filters']['register'] = $this->register;
$config['filters']['schema'] = $this->schema;
$requestParams['_register'] = $this->register;
$requestParams['_schema'] = $this->schema;The docstrings call this out, but it's an easy trap for callers. Worth normalising in a follow-up so both methods accept the same shape. |
Summary
Adds
ObjectServiceMapperAdapterand the wiring inObjectServiceso external apps can obtain a mapper-like interface over OpenRegister objects without depending onObjectServiceinternals.Changes
lib/Service/ObjectServiceMapperAdapter.php(new)Adapter wrapping
ObjectServicewith a mapper-style API. Register and schema context are injected at construction time and applied to every call.find/findByUuid— look up a single object by ID or UUIDfindAll— list objects with optional filters/pagination config (usesfilters.register/filters.schemakeys)findAllPaginated— list with pagination viasearchObjectsPaginated(), returnsresults/total/page/pages(uses_register/_schemakeys)createFromArray— create object with adapter's register/schema contextupdateFromArray— PUT (full replace) and PATCH (partial merge) both route throughsaveObject()with register/schema context; PATCH fetches the existing object via UUID-safefind()before mergingupdate— persist a hydratedObjectEntitydelete— soft-delete bycriteria['id']getSchema/getRegister/getValidateHandlerlib/Service/ObjectService.php(additions)getMapper(register, schema)— returns a newObjectServiceMapperAdapter; non-numeric string arguments (e.g.'objectEntity'type hints from OpenConnector) produce an unconstrained adapter that searches across all registers/schemasgetValidateHandler()— exposes the internalValidateObjecthandlerclearCurrents()— resetscurrentRegister,currentSchema,currentObjectstateBug fixes included
patchObject()cast the UUID tointvia(int) $objectId→ 0, so the existing-object lookup always failed.updateFromArraynow fetches via UUID-safefind()and merges directly.updateObject()calledsaveObject()without register/schema context. Both PUT and PATCH now go throughsaveObject()with the adapter's injected context.Related
Coordinated with openconnector#723 which updates the type hint references in
EndpointService.Test plan
targetType: register/schemacount/results/next/previousgetMapper('objectEntity')->find($uuid)— unconstrained adapter finds object across all registers🤖 Generated with Claude Code