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

Introduce EntityRepositoryInterface, ancestor for custom repositories #6871

Closed

Conversation

Majkl578
Copy link
Contributor

@Majkl578 Majkl578 commented Dec 9, 2017

Introducing a common ancestor for custom repositories.
Currently there is a slight mess, some pieces of code only specify ObjectRepository which:
a) is insufficient since it's missing Selectable;
b) is incorrect since following code expects EntityRepository.

I've taken the opportunity to also add return types to the interface and default repository. Also updated some phpDocs - specialized array and removed duplicate information.

This change should not affect 99.9% of user code since almost everyone extends EntityRepository, but allows 1% to use custom repositories in fancier way.

TODO:

  • constructor should be part of the interface or made parameterless
  • make Scrutinizer happy

@guilhermeblanco
Copy link
Member

This interface should be part of Doctrine\Persistence module, and also we do not suffix with Interface

@Majkl578
Copy link
Contributor Author

We already have ObjectRepository as a base interface. This interface extends it with ORM-specific methods like createQueryBuilder or by adding Criteria support. I don't think those are methods that'd belong to base persistence layer, i.e. ODM doesn't support Criteria.
Suffix is there because EntityRepository is already taken by default imlementation.

@Majkl578 Majkl578 force-pushed the dev/EntityRepositoryInterface branch from 03e9bc3 to 7b842aa Compare January 1, 2018 19:52
@Majkl578 Majkl578 changed the base branch from develop to master January 2, 2018 20:30
@Majkl578 Majkl578 closed this Apr 16, 2019
@Majkl578 Majkl578 deleted the dev/EntityRepositoryInterface branch April 16, 2019 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants