Skip to content
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 declaring repository on resource when it is a service entity repository #510

Merged

Conversation

loic425
Copy link
Member

@loic425 loic425 commented Nov 29, 2022

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no -->
Related tickets
License MIT

It fixes this issue https://github.com/Sylius/SyliusResourceBundle/actions/runs/3575281362/jobs/6011624266#step:11:27

@loic425 loic425 requested a review from a team as a code owner November 29, 2022 15:00
@loic425 loic425 added the Bug Confirmed bugs or bugfixes. label Nov 29, 2022
@loic425 loic425 force-pushed the fix/di-on-service-entity-repositories branch from cef6da0 to a6c4c59 Compare November 29, 2022 15:14
@loic425 loic425 force-pushed the fix/di-on-service-entity-repositories branch from a6c4c59 to b0ddbd2 Compare November 29, 2022 15:16
@loic425
Copy link
Member Author

loic425 commented Nov 30, 2022

I'm wondering if we can go further, cause we can inject other dependencies into the repository. Maybe we should check if the FQCN is already registered and autowired. If we are in this case, we have nothing to do.

@@ -68,7 +68,12 @@ protected function addRepository(ContainerBuilder $container, MetadataInterface

$genericEntities[] = $entityClass;
} else {
$definition->setArguments([$managerReference, $this->getClassMetadataDefinition($metadata)]);
if (is_a($repositoryClass, ServiceEntityRepository::class, true)) {
$definition->setArguments([new Reference('doctrine')]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you decide on a new doctrine reference instead of new Reference($metadata->getServiceId('manager'));?

@lchrusciel lchrusciel merged commit f85f132 into Sylius:1.10 Dec 8, 2022
@loic425 loic425 deleted the fix/di-on-service-entity-repositories branch December 8, 2022 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed bugs or bugfixes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants