Skip to content

[MAINTENANCE] Centralize storage PID application for repositories in BasketController#1943

Open
beatrycze-volk wants to merge 7 commits intokitodo:mainfrom
beatrycze-volk:mail-repository
Open

[MAINTENANCE] Centralize storage PID application for repositories in BasketController#1943
beatrycze-volk wants to merge 7 commits intokitodo:mainfrom
beatrycze-volk:mail-repository

Conversation

@beatrycze-volk
Copy link
Copy Markdown
Collaborator

Remove special case in MailRepository, call there directly findAll()

Depends on #1941

Centralizes the logic for setting storage page IDs for Extbase repositories.

All repositories now extend this new abstract class, gaining access to a
unified `setStoragePid` method to configure query settings, reducing
code duplication and improving maintainability.
Explicitly sets the 'storagePid' from plugin settings on various repositories within controller actions. This ensures consistent data retrieval and manipulation by correctly scoping repository queries to the configured storage page, leveraging the `setStoragePid` method introduced with `AbstractRepository`.
This change ensures that functional tests correctly pass the `storagePid` setting to controller actions. This aligns the tests with the updated repository logic, which now expects the `storagePid` for scoping queries, as introduced by the `AbstractRepository` and applied in recent controller changes.
Relocates the `setStoragePid` call from `initializeAction` to `initializeDocumentRepository`. This ensures that the `storagePid` setting is processed by `sanitizeSettings()` before being passed to the document repository, improving initialization order and robustness.
Aligns the `initializeRepository` helper with the `AbstractRepository` by using its `setStoragePid` method. This removes the need for explicit `Typo3QuerySettings` setup in functional tests, streamlining repository instantiation.
All repositories now extend `AbstractRepository`, which in turn extends `TYPO3\CMS\Extbase\Persistence\Repository`. This makes the direct `use` statement in individual repository classes redundant and can be removed for cleaner code.
Introduces a new `setStoragePid` method in `BasketController` to consistently apply the configured storage PID to all relevant repositories early in the action lifecycle.

This refactoring removes the need for specific repository methods like `findAllWithPid`, as the storage PID is now set once on the repository itself (via `AbstractRepository`) before general `findAll()` calls.
@beatrycze-volk beatrycze-volk self-assigned this Apr 28, 2026
@beatrycze-volk beatrycze-volk added the ⟳ maintenance A task to keep the code up-to-date and manageable. label Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⟳ maintenance A task to keep the code up-to-date and manageable.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant