Anastasia Lysenko
1 min readJun 14, 2018

--

Hello, Adam! Thank you for your detail answer!
I’m totally agree, that DRY is about knowledge and possibility to determine whether it’d better with “duplication” or not.
Yes, all repositories have identical methods, that differs only with Entity (Doctrine now) as a param for findById method. For all Repositories we have interfaces in Domain/Repository with individual for this Repository methods. We have other ‘sharing implementations’ for each domain (helpers, extensions, even ‘doctrine-related’ modules, etc), so in any case it’s not a ‘can be a module’ system anyway.
So, I propose general abstract Entity (to extends on) and general abstract Repository for all duplicates (findById, save and remove (last two methods identical everywhere, except two unusual)).

--

--

Anastasia Lysenko
Anastasia Lysenko

Written by Anastasia Lysenko

Experienced developer, team lead and architect, who see the patterns everywhere and love to keep code in well-documented, clean and organized shape.