-
Notifications
You must be signed in to change notification settings - Fork 17
IBX-8400: Fixed redundancy in RepositoryFactory implementations #384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Steveb-p
approved these changes
Jun 13, 2024
konradoboza
approved these changes
Jun 14, 2024
16ae74a to
9130e95
Compare
Base automatically changed from
ibx-8399-move-repository-configuration-provider
to
main
June 18, 2024 12:41
Properly decorate RepositoryFactory instead, if custom Repository is needed (not recommended)
e3e913f to
139b872
Compare
|
|
Note: merging as-is. Regression tests here should be enough. |
barw4
pushed a commit
that referenced
this pull request
Oct 17, 2024
For more details see https://issues.ibexa.co/browse/IBX-8400 and #384 Key changes: * Dropped support for dynamic Core Repository class in RepositoryFactory * Made RepositoryFactory not Container-aware * Deprecated Core Bundle RepositoryFactory in favor of Repository's one * Combined Bundle and core RepositoryFactory into one * [Tests] Added needed RepositoryFactory configuration to test setup * [PHPStan] Introduced role policy map array shape as TPolicyMap * [PHPStan] Aligned baseline after the changes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.




Related PRs:
Description:
TL;DR;
Merged Core Bundle and Core Repository layer
RepositoryFactoryclasses into one. Deprecated the Bundle one in favor of the Repository one.Background
We have ambiguous and redundant RepositoryFactory DI definitions and implementations on Bundle and Repository levels respectively.
Basically
Ibexa\Bundle\Core\ApiLoader\RepositoryFactoryfor Repository layer is a named service withIbexa\Core\Base\Container\ApiLoader\RepositoryFactoryas its implementation. Then on Bundle level it's overridden by the actual class implementation.This causes quite a headache for both rector and static analysis. Moreover to modify any of the Repository services, changes to both classes are needed, which is difficult due to PHPStorm not understanding which definition is being modified. So this also constitutes a maintenance hell. We've also had issues in the past where due to existence of multiple
RepositoryFactorydefinitions (maybe not ATM as it's overridden) wrong instances of services were injected (e.g. uninitialized permission resolver).I've decided to extract some common abstraction and using it merge Bundle logic with Repository logic and use in DI only the Core Repository
RepositoryFactory. ATM the Bundle one is just deprecated, however as in case of #383, I hope to back-port that to 4.6 and drop it here.Additionally I've dropped support for dynamic Core Repository class passed as
RepositoryFactoryservice argument. This is also difficult to maintain and makes no sense (substitution principle-wise) as it requires for a constructor to have the same argument list. If a customRepositoryclass is needed, the entireRepositoryFactoryshould be properly decorated.All the changes allowed me to drop Container-awareness from
RepositoryFactoryand use proper dependency injection forRepositoryConfigurationProvider(see #383).The legacy integration test setup configuration has been modified to have the same effect after changes to the factory.
I've also added an array shape
TPolicyMapfor policy configuration injected intoRoleServicethroughRepositorythroughRepositoryFactoryChangelog:
For QA:
Regressions done via ibexa/commerce#877 should be enough.
Documentation:
RepositoryFactoryin favor of the Core Repository one