Jul 16, 2023
That Interface make your code more abstract, it makes you able to inject what ever implementation of the repository that you want, the easiest application is where you want to write unit tests, you can inject a dummy implementation of that interface, or for another example, if you want to change from MySQL to Redis you just inject the Redis implementation of that interface, by the way I have written an example for testing part : https://saeidme.medium.com/symfony-testing-using-repository-pattern-without-connecting-to-database-f1ec1f147372