Sylius / Sylius/SyliusResourceBundle

[Repository] Impossible to use a repository that implements ServiceEntityRepositoryInterface

Open
#855 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
235
Forks
166
PR merge metrics
No merged PRs in 30d

Description

Sylius version affected: all

Description
It is possible to use a repository that inherits from ServiceEntityRepository but not a repository that "just" implements ServiceEntityRepositoryInterface. Besides it's useful when you already extends from some other base repository.

Steps to reproduce

  1. Create a repository that implements ServiceEntityRepositoryInterface
  2. Use it in the resource bundle config

Possible Solution

Check against the interface instead of the class.

https://github.com/Sylius/SyliusResourceBundle/blob/01132cb4646da060b573ba46ff8e22e21d064181/src/Bundle/DependencyInjection/Driver/Doctrine/DoctrineORMDriver.php#L74

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect src/Bundle/DependencyInjection/Driver/Doctrine/DoctrineORMDriver.php around line 74 and trace how the repository class is checked during resource bundle configuration. Reproduce the configuration with a repository implementing ServiceEntityRepositoryInterface, then verify that it is accepted without requiring inheritance from ServiceEntityRepository.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
backend, database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.