Repository navigation
[Bug] Load dynamic select options for classification store keys - #2153
ValeriaMaltseva wants to merge 3 commits into
Conversation
Resolve classification store keys addressed as "<store>.<groupId>.<keyId>" (optionally with the localization before the key id) and pass the same owner context (ownerType, ownerName, keyId, groupId, keyDefinition) to the options provider as the core layout enrichment does. An unresolvable field name is now reported with its parse error instead of a misleading "Class with ID ... not found". Fixes pimcore/platform-version#577 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The shared helper breaks compatibility with existing overrides, and key resolution lacks validation against the owning field’s configured store.
2 open issues
What changed in this PR
Verdict: Needs changes. This PR addresses classification store dropdown failures from pimcore/platform-version#577 by resolving key paths and preserving the context expected by dynamic options providers.
Changes:
- Registers a resolver for classification store paths, including the language-comparison form.
- Carries owner context through the field-definition wrapper to options providers.
- Reports parse failures as invalid arguments and adds focused regression tests.
The fix targets the underlying parsing and context gaps at the resolver/service boundary (ClassificationStoreResolver.php:70–110, SelectOptionsService.php:76–98). The tests cover resolution, provider context, and error reporting; they were not executed during this review. Shared extension compatibility remains unresolved.
No documentation changes are included. The coordinated UI change in pimcore/studio-ui-bundle#4264 and a running-Studio check with a real provider remain integration requirements, including a maintainer check of store-boundary validation.
| File | Description |
|---|---|
| tests/Unit/FieldDefinition/Parser/Resolver/ClassificationStoreResolverTest.php | Tests key paths, owner context, and lookup failures. |
| tests/Unit/DataObject/Service/SelectOptionsServiceTest.php | Tests provider context and preserved parse messages. |
| src/FieldDefinition/Parser/Resolver/ClassificationStoreResolver.php | Resolves classification store keys and supplies owner context. |
| src/FieldDefinition/Parser/Resolver/AbstractResolver.php | Extends the wrapper helper to pass provider context. |
| src/FieldDefinition/FieldDefinitionWrapper.php | Stores optional options-provider context. |
| src/DataObject/Service/SelectOptionsService.php | Passes context to providers and distinguishes parse errors. |
| config/field_definition.yaml | Registers the classification store resolver. |
Review effort: Balanced
…'s store - Restore the five-parameter wrapFieldDefinition() so custom resolvers overriding it keep working; ClassificationStoreResolver builds its FieldDefinitionWrapper directly. - Reject a group that does not belong to the store of the classification store field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|





Changes in this pull request
Resolves pimcore/platform-version#577
Opening the dropdown of a classification store select key with an options provider failed with
Class with ID: 1 not found. Studio UI sent only the key id (fieldName=6). The dot notation parser had no classification store case, and the broadcatch (Exception)inSelectOptionsServicereplaced the real parse error with a misleading "class not found".ClassificationStoreResolverfor<storeFieldName>.<groupId>.<keyId>. It also accepts<storeFieldName>.<groupId>.<language>.<keyId>, which the language comparison view sends; the key definition doesn't depend on the language. It looks up theKeyGroupRelationand builds the key definition from it.FieldDefinitionWrapper::getOptionsProviderContext()(optional, defaults to[]). The resolver fills it with the context core's classification store layout enrichment passes:ownerType,ownerName,keyId,groupId,keyDefinition.SelectOptionsServicemerges it into the provider context, so providers get the same context on refresh as on the initial layout load.ParseExceptionnow becomes anInvalidArgumentException(422) with the real message. Other failures keep the existingNotFoundException.Needs the Studio UI change that sends the new field name: pimcore/studio-ui-bundle#4264
Additional info
Verified locally:
ClassificationStoreResolverTest, 2 new cases inSelectOptionsServiceTest(the owner context reaches the provider; a parse error keeps its message), and the existingBlockResolverTest.pimcore.studio_backend.field_definition_resolvertag.technicalAttributes):technicalAttributes.3.6andtechnicalAttributes.3.en.6both resolve to the Select keyrimMaterialwith key 6 and group 3. A wrong group givesKey "6" does not exist in classification store group "4".Not verified: php-cs-fixer isn't installed in the dev container, so CI is the style check. I haven't tested a real options provider in a running Studio, because the demo has no classification store key with a provider configured.
Manual test:
@serviceprovider.ownerType=classificationstore,ownerName,keyIdandgroupId.🤖 Generated with Claude Code