Wouldn’t generics make implementing the Repository pattern a lot easier?

Instead of having interfaces for every single model type in your database, for example UserRepositoryInterface, ArticleRepositoryInterface, etc, you could have RepositoryInterface with methods like findOne(): T, and then each Repository implements that interface for its respective Model.

Is there an advantage for doing what we currently have to do?

submitted by /u/Hates_Sundays
[link] [comments]