-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fix setting current user to multiple Repositories #67
Conversation
I'll look at it soon. For now, only a coment that this should probably go against 2.1 branch. That's where filter service was introduced. |
Agreed, this is to |
I can confirm, it does solve issue in my case. |
BTW, if someone already implements a custom Repository layer, it would have to be done like here, by replacing |
I realize that there is no sane way to do this, but just for the record, I'm not sure I like replacing the That being said, if we're going to go this way, it would be great if we could add custom repositories to the agreggate one with tags, so potential custom repositories can be added to the aggregate automatically, without having to modify the aggregate repo service definition. Other than that, this looks good 👍 |
Actually, that should be possible, one should be able to implement own API layer and AFAIK this would be the way to do it. The weird part is second instance of Repository, but we had that before. And probably will have it until |
lib/Resources/config/internal.yml
Outdated
# | ||
netgen.ezplatform_site.aggregate_repository: | ||
class: Netgen\EzPlatformSiteApi\Core\Repository\Aggregate\Repository | ||
arguments: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a private service by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in a822caa.
@emodric implemented custom repo registration through service tag in f7a8dee @MarioBlazek please test |
@@ -38,10 +38,23 @@ class Repository implements RepositoryInterface | |||
*/ | |||
public function __construct( | |||
RepositoryInterface $ezRepository, | |||
array $customRepositories | |||
array $customRepositories = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we now need a second param here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use it here, I just always add it to aggregate implementation of something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then you don't need addRepository
method, since you can use $definition->replaceArgument(1, [...])
in the compiler pass, where [...]
is an array of Reference
objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, updated in 4591139
👍, with rebase to |
Thanks guys, merged manually. |
Fixes #64
This fixes the problem of setting current Repository user, where Repository instance used to get SearchService with Legacy Search Engine (used for FilterService) was not updated. Current User is the only state Core Repository keeps.
The problem is fixed with new Aggregate Repository implementation, which is registered as public Repository (it rewrites
ezpublish.api.repository
alias). This implementation aggregates top eZ Platform Repository implementation (defaultezpublish.api.repository
alias) and our custom instance and updates current user on all of them.