{"action":"created","issue":{"url":"https://api.github.com/repos/webdevilopers/php-ddd/issues/2","repository_url":"https://api.github.com/repos/webdevilopers/php-ddd","labels_url":"https://api.github.com/repos/webdevilopers/php-ddd/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/webdevilopers/php-ddd/issues/2/comments","events_url":"https://api.github.com/repos/webdevilopers/php-ddd/issues/2/events","html_url":"https://github.com/webdevilopers/php-ddd/issues/2","id":149058962,"number":2,"title":"Blending ORM and ODM but keeping the Domain Model clean","user":{"login":"webdevilopers","id":3479626,"avatar_url":"https://avatars.githubusercontent.com/u/3479626?v=3","gravatar_id":"","url":"https://api.github.com/users/webdevilopers","html_url":"https://github.com/webdevilopers","followers_url":"https://api.github.com/users/webdevilopers/followers","following_url":"https://api.github.com/users/webdevilopers/following{/other_user}","gists_url":"https://api.github.com/users/webdevilopers/gists{/gist_id}","starred_url":"https://api.github.com/users/webdevilopers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webdevilopers/subscriptions","organizations_url":"https://api.github.com/users/webdevilopers/orgs","repos_url":"https://api.github.com/users/webdevilopers/repos","events_url":"https://api.github.com/users/webdevilopers/events{/privacy}","received_events_url":"https://api.github.com/users/webdevilopers/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/webdevilopers/php-ddd/labels/Doctrine%20ODM","name":"Doctrine ODM","color":"006b75"},{"url":"https://api.github.com/repos/webdevilopers/php-ddd/labels/Doctrine%20ORM","name":"Doctrine ORM","color":"5319e7"},{"url":"https://api.github.com/repos/webdevilopers/php-ddd/labels/DomainModel%20Layer","name":"DomainModel Layer","color":"bfdadc"},{"url":"https://api.github.com/repos/webdevilopers/php-ddd/labels/MongoDB","name":"MongoDB","color":"bfdadc"},{"url":"https://api.github.com/repos/webdevilopers/php-ddd/labels/Persistence","name":"Persistence","color":"b60205"},{"url":"https://api.github.com/repos/webdevilopers/php-ddd/labels/Tactical%20DDD","name":"Tactical DDD","color":"e99695"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":26,"created_at":"2016-04-18T06:51:23Z","updated_at":"2016-05-09T18:52:28Z","closed_at":null,"body":"When trying to use Doctrine ORM Entities with ODM Documents (e.g. MongoDB) most solutions adding extra fields:\r\n* http://doctrine-orm.readthedocs.org/projects/doctrine-mongodb-odm/en/latest/cookbook/blending-orm-and-mongodb-odm.html @jmikola\r\n* http://de.slideshare.net/spf13/blending-mongodb-and-rdbms-for-ecommerce by @jwage\r\n* https://github.com/Atlantic18/DoctrineExtensions/issues/1564#issue-148766564\r\n\r\nFor me this feels like \"polluting\" the Domain Model with extra properties to fit the infrastructure.\r\nSo I am currently looking for a way to keep the Domain Models clean:\r\n* https://github.com/Atlantic18/DoctrineExtensions/issues/750#issuecomment-210645574\r\n* https://twitter.com/webdevilopers/status/720289162142744576\r\n\r\nA possible workaround could be a custom mapper:\r\n* https://github.com/akeneo/pim-community-dev/blob/master/src/Akeneo/Bundle/StorageUtilsBundle/Doctrine/MongoDBODM/Types/Entities.php by @nidup\r\n\r\nA different solution could be treating referenced entities as Value Objects which at the same time could serve as a historical \"query database\".\r\n\r\nFor instance:\r\nInstead 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.\r\n\r\nRemember kids:\r\n> Implementation issues (such as persistence) are not dealt with in the model, but they must be in the design.” - @ericevans0\r\nhttps://twitter.com/fromddd/status/725604978564308992"},"comment":{"url":"https://api.github.com/repos/webdevilopers/php-ddd/issues/comments/217954817","html_url":"https://github.com/webdevilopers/php-ddd/issues/2#issuecomment-217954817","issue_url":"https://api.github.com/repos/webdevilopers/php-ddd/issues/2","id":217954817,"user":{"login":"Ocramius","id":154256,"avatar_url":"https://avatars.githubusercontent.com/u/154256?v=3","gravatar_id":"","url":"https://api.github.com/users/Ocramius","html_url":"https://github.com/Ocramius","followers_url":"https://api.github.com/users/Ocramius/followers","following_url":"https://api.github.com/users/Ocramius/following{/other_user}","gists_url":"https://api.github.com/users/Ocramius/gists{/gist_id}","starred_url":"https://api.github.com/users/Ocramius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ocramius/subscriptions","organizations_url":"https://api.github.com/users/Ocramius/orgs","repos_url":"https://api.github.com/users/Ocramius/repos","events_url":"https://api.github.com/users/Ocramius/events{/privacy}","received_events_url":"https://api.github.com/users/Ocramius/received_events","type":"User","site_admin":false},"created_at":"2016-05-09T18:52:28Z","updated_at":"2016-05-09T18:52:28Z","body":"@webdevilopers fields are not a big deal, in my opinion. As long as the public API stays clean, you are safe from complications.\r\n\r\nAs @VaughnVernon says, you can just hide it as a detail.\r\n\r\n[It's all about the greater good](https://www.youtube.com/watch?v=yUpbOliTHJY)"}}