Skip to content

[MAINTENANCE] Introduce AbstractRepository for unified storage PID management#1941

Open
beatrycze-volk wants to merge 6 commits intokitodo:mainfrom
beatrycze-volk:repositories
Open

[MAINTENANCE] Introduce AbstractRepository for unified storage PID management#1941
beatrycze-volk wants to merge 6 commits intokitodo:mainfrom
beatrycze-volk:repositories

Conversation

@beatrycze-volk
Copy link
Copy Markdown
Collaborator

Currently functions like findAll() and custom functions which use createQuery() do not work, becuase pid in the generated SQL is always 0. It is necessary to set up storagePid.

See:
https://docs.typo3.org/permalink/t3coreapi:extbase-repository-query-setting
https://docs.typo3.org/permalink/t3coreapi:typo3-cms-extbase-persistence-repository-setdefaultquerysettings

@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
@beatrycze-volk beatrycze-volk marked this pull request as draft April 28, 2026 11:42
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.
@beatrycze-volk beatrycze-volk force-pushed the repositories branch 4 times, most recently from 2382d2e to edab140 Compare April 28, 2026 12:46
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.
@beatrycze-volk beatrycze-volk marked this pull request as ready for review April 28, 2026 14:13
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.
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