-
Notifications
You must be signed in to change notification settings - Fork 11
Description
When trying to use Doctrine ORM Entities with ODM Documents (e.g. MongoDB) most solutions adding extra fields:
- http://doctrine-orm.readthedocs.org/projects/doctrine-mongodb-odm/en/latest/cookbook/blending-orm-and-mongodb-odm.html @jmikola
- http://de.slideshare.net/spf13/blending-mongodb-and-rdbms-for-ecommerce by @jwage
- Add XML mapping example for References doctrine-extensions/DoctrineExtensions#1564 (comment)
For me this feels like "polluting" the Domain Model with extra properties to fit the infrastructure.
So I am currently looking for a way to keep the Domain Models clean:
- ODM double properties for ORM mapping doctrine-extensions/DoctrineExtensions#750 (comment)
- https://twitter.com/webdevilopers/status/720289162142744576
A possible workaround could be a custom mapper:
- https://github.com/akeneo/pim-community-dev/blob/master/src/Akeneo/Bundle/StorageUtilsBundle/Doctrine/MongoDBODM/Types/Entities.php by @nidup
A different solution could be treating referenced entities as Value Objects which at the same time could serve as a historical "query database".
For instance:
Instead of linking an ODM Order Document (still an "Entity" in DDD though) with an ORM Customer you introduce a Customer Value Object that keeps Id and full name. Maybe the delivery and / or invoice address too.
Remember kids:
Implementation issues (such as persistence) are not dealt with in the model, but they must be in the design.” - @ericevans0
https://twitter.com/fromddd/status/725604978564308992