Decoupling and Doctrine

How to work with Doctrine in order to keep everything decoupled as much as possible and also to prepare for replacing Doctrine someday for some other data-mapper solution?

I understand that I should use XML / Yaml / Php Mappings instead of @Annotations in order to keep Entities and Mappings separated to achieve SRP i.e.

Should I use Association Mappings?
I see that Associations cause coupling but I like to work with objects.

Should I use DQL in Repositories or i.e. NamedNativeQueries with SqlResultSetMappings written in XML / Yaml for a sustainable decoupled code?

What are the best practices?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *