Skip to content

fix Index class dropdown to only show IndexableInterface classes#3022

Merged
dpfaffenbauer merged 4 commits intocoreshop:5.1from
dpfaffenbauer:fix/5.1-index-indexable-class-choice
Apr 23, 2026
Merged

fix Index class dropdown to only show IndexableInterface classes#3022
dpfaffenbauer merged 4 commits intocoreshop:5.1from
dpfaffenbauer:fix/5.1-index-indexable-class-choice

Conversation

@dpfaffenbauer
Copy link
Copy Markdown
Member

Summary

The Class dropdown in the Index configuration (Studio UI) currently shows all Pimcore DataObject classes, even though only classes whose generated model implements IndexableInterface can actually be indexed. The filter logic already existed inline inside IndexController::getConfigAction, but the form-schema endpoint used an unfiltered PimcoreClassChoiceType, so the Studio dropdown still exposed every class.

This PR introduces a single source of truth for "indexable Pimcore classes" and consumes it from both the Form Schema and the Controller.

Change

  • New CoreShop\Component\Index\Service\IndexableClassesProviderInterface with single method getIndexableClassNames(): array<string>.
  • New CoreShop\Bundle\IndexBundle\Service\IndexableClassesProvider — walks ClassDefinition\Listing and filters by IndexableInterface (same logic that was inline in the controller).
  • New CoreShop\Bundle\IndexBundle\Form\Type\IndexablePimcoreClassChoiceType — ChoiceType that consumes the provider. Used in IndexType instead of the generic PimcoreClassChoiceType.
  • Refactor IndexController::getConfigAction — replaced the inline loop with a provider call.
  • PimcoreClassChoiceType in ResourceBundle stays untouched (generic API for "pick any Pimcore class" remains available for other consumers).

Test plan

  • Index config dropdown shows only IndexableInterface-implementing classes (CoreShopProduct, CoreShopCategory, …) — not every DataObject in the system.
  • GET /pimcore-studio/api/coreshop/indexes/config returns the same filtered list as before (no behavior change on the JSON response).
  • Behat / static tests pass.

@sonarqubecloud
Copy link
Copy Markdown

@dpfaffenbauer dpfaffenbauer merged commit 8f55683 into coreshop:5.1 Apr 23, 2026
214 checks passed
@dpfaffenbauer dpfaffenbauer deleted the fix/5.1-index-indexable-class-choice branch April 23, 2026 06:13
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant