{"action":"created","comment":{"url":"https://api.github.com/repos/bitladen-nw/createphp/pulls/comments/29107753","id":29107753,"diff_hunk":"@@ -37,6 +37,36 @@ class DoctrineOrmMapper extends BaseDoctrineRdfMapper\n     /**\n      * {@inheritDoc}\n      *\n+     * The ORM implementation for preparing the object\n+     */\n+    public function prepareObject(TypeInterface $type, $parent = null)\n+    {\n+        $object = parent::prepareObject($type);\n+\n+        if (null == $parent){\n+            throw new RuntimeException('You need a parent to create new objects');\n+        }\n+\n+        /** @var \\Doctrine\\ORM\\Mapping\\ClassMetadata $metaData */\n+        $metaData = $this->om->getClassMetaData(get_class($object));\n+        $metaDataParent = $this->om->getClassMetaData(get_class($parent));\n+\n+        foreach ($metaData->associationMappings as $mapping)","path":"src/Midgard/CreatePHP/Mapper/DoctrineOrmMapper.php","position":18,"original_position":18,"commit_id":"bd53f2f3353f1d1c29ef307dc5304121d3dcd773","original_commit_id":"bd53f2f3353f1d1c29ef307dc5304121d3dcd773","user":{"login":"dbu","id":76576,"avatar_url":"https://avatars.githubusercontent.com/u/76576?v=3","gravatar_id":"","url":"https://api.github.com/users/dbu","html_url":"https://github.com/dbu","followers_url":"https://api.github.com/users/dbu/followers","following_url":"https://api.github.com/users/dbu/following{/other_user}","gists_url":"https://api.github.com/users/dbu/gists{/gist_id}","starred_url":"https://api.github.com/users/dbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbu/subscriptions","organizations_url":"https://api.github.com/users/dbu/orgs","repos_url":"https://api.github.com/users/dbu/repos","events_url":"https://api.github.com/users/dbu/events{/privacy}","received_events_url":"https://api.github.com/users/dbu/received_events","type":"User","site_admin":false},"body":"the use case i think of is that e.g. my class has references to objects of the same class once as parent and once as children. then i would need to have custom logic as the generic logic fails. \r\n\r\ni would pass $object and $metadata. we are in an orm context, so it does not hurt to have it.","created_at":"2015-04-26T08:33:48Z","updated_at":"2015-04-26T08:33:48Z","html_url":"https://github.com/bitladen-nw/createphp/pull/1#discussion_r29107753","pull_request_url":"https://api.github.com/repos/bitladen-nw/createphp/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/bitladen-nw/createphp/pulls/comments/29107753"},"html":{"href":"https://github.com/bitladen-nw/createphp/pull/1#discussion_r29107753"},"pull_request":{"href":"https://api.github.com/repos/bitladen-nw/createphp/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/bitladen-nw/createphp/pulls/1","id":34044677,"html_url":"https://github.com/bitladen-nw/createphp/pull/1","diff_url":"https://github.com/bitladen-nw/createphp/pull/1.diff","patch_url":"https://github.com/bitladen-nw/createphp/pull/1.patch","issue_url":"https://api.github.com/repos/bitladen-nw/createphp/issues/1","number":1,"state":"open","locked":false,"title":"Update DoctrineOrmMapper.php","user":{"login":"bitladen-nw","id":11576763,"avatar_url":"https://avatars.githubusercontent.com/u/11576763?v=3","gravatar_id":"","url":"https://api.github.com/users/bitladen-nw","html_url":"https://github.com/bitladen-nw","followers_url":"https://api.github.com/users/bitladen-nw/followers","following_url":"https://api.github.com/users/bitladen-nw/following{/other_user}","gists_url":"https://api.github.com/users/bitladen-nw/gists{/gist_id}","starred_url":"https://api.github.com/users/bitladen-nw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitladen-nw/subscriptions","organizations_url":"https://api.github.com/users/bitladen-nw/orgs","repos_url":"https://api.github.com/users/bitladen-nw/repos","events_url":"https://api.github.com/users/bitladen-nw/events{/privacy}","received_events_url":"https://api.github.com/users/bitladen-nw/received_events","type":"User","site_admin":false},"body":"while implementing collections using ORM i came accross the missing implementation for `DoctrineOrmMapper:prepareObject()`... well, here is mine. ","created_at":"2015-04-24T12:41:38Z","updated_at":"2015-04-26T08:33:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0fb4ab128b56b414a70fcb1a9078d00ea6c45584","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bitladen-nw/createphp/pulls/1/commits","review_comments_url":"https://api.github.com/repos/bitladen-nw/createphp/pulls/1/comments","review_comment_url":"https://api.github.com/repos/bitladen-nw/createphp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bitladen-nw/createphp/issues/1/comments","statuses_url":"https://api.github.com/repos/bitladen-nw/createphp/statuses/bd53f2f3353f1d1c29ef307dc5304121d3dcd773","head":{"label":"bitladen-nw:bitladen-nw-patch-1","ref":"bitladen-nw-patch-1","sha":"bd53f2f3353f1d1c29ef307dc5304121d3dcd773","user":{"login":"bitladen-nw","id":11576763,"avatar_url":"https://avatars.githubusercontent.com/u/11576763?v=3","gravatar_id":"","url":"https://api.github.com/users/bitladen-nw","html_url":"https://github.com/bitladen-nw","followers_url":"https://api.github.com/users/bitladen-nw/followers","following_url":"https://api.github.com/users/bitladen-nw/following{/other_user}","gists_url":"https://api.github.com/users/bitladen-nw/gists{/gist_id}","starred_url":"https://api.github.com/users/bitladen-nw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitladen-nw/subscriptions","organizations_url":"https://api.github.com/users/bitladen-nw/orgs","repos_url":"https://api.github.com/users/bitladen-nw/repos","events_url":"https://api.github.com/users/bitladen-nw/events{/privacy}","received_events_url":"https://api.github.com/users/bitladen-nw/received_events","type":"User","site_admin":false},"repo":{"id":34517293,"name":"createphp","full_name":"bitladen-nw/createphp","owner":{"login":"bitladen-nw","id":11576763,"avatar_url":"https://avatars.githubusercontent.com/u/11576763?v=3","gravatar_id":"","url":"https://api.github.com/users/bitladen-nw","html_url":"https://github.com/bitladen-nw","followers_url":"https://api.github.com/users/bitladen-nw/followers","following_url":"https://api.github.com/users/bitladen-nw/following{/other_user}","gists_url":"https://api.github.com/users/bitladen-nw/gists{/gist_id}","starred_url":"https://api.github.com/users/bitladen-nw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitladen-nw/subscriptions","organizations_url":"https://api.github.com/users/bitladen-nw/orgs","repos_url":"https://api.github.com/users/bitladen-nw/repos","events_url":"https://api.github.com/users/bitladen-nw/events{/privacy}","received_events_url":"https://api.github.com/users/bitladen-nw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bitladen-nw/createphp","description":"PHP adapter for Create.js","fork":true,"url":"https://api.github.com/repos/bitladen-nw/createphp","forks_url":"https://api.github.com/repos/bitladen-nw/createphp/forks","keys_url":"https://api.github.com/repos/bitladen-nw/createphp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bitladen-nw/createphp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bitladen-nw/createphp/teams","hooks_url":"https://api.github.com/repos/bitladen-nw/createphp/hooks","issue_events_url":"https://api.github.com/repos/bitladen-nw/createphp/issues/events{/number}","events_url":"https://api.github.com/repos/bitladen-nw/createphp/events","assignees_url":"https://api.github.com/repos/bitladen-nw/createphp/assignees{/user}","branches_url":"https://api.github.com/repos/bitladen-nw/createphp/branches{/branch}","tags_url":"https://api.github.com/repos/bitladen-nw/createphp/tags","blobs_url":"https://api.github.com/repos/bitladen-nw/createphp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bitladen-nw/createphp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bitladen-nw/createphp/git/refs{/sha}","trees_url":"https://api.github.com/repos/bitladen-nw/createphp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bitladen-nw/createphp/statuses/{sha}","languages_url":"https://api.github.com/repos/bitladen-nw/createphp/languages","stargazers_url":"https://api.github.com/repos/bitladen-nw/createphp/stargazers","contributors_url":"https://api.github.com/repos/bitladen-nw/createphp/contributors","subscribers_url":"https://api.github.com/repos/bitladen-nw/createphp/subscribers","subscription_url":"https://api.github.com/repos/bitladen-nw/createphp/subscription","commits_url":"https://api.github.com/repos/bitladen-nw/createphp/commits{/sha}","git_commits_url":"https://api.github.com/repos/bitladen-nw/createphp/git/commits{/sha}","comments_url":"https://api.github.com/repos/bitladen-nw/createphp/comments{/number}","issue_comment_url":"https://api.github.com/repos/bitladen-nw/createphp/issues/comments{/number}","contents_url":"https://api.github.com/repos/bitladen-nw/createphp/contents/{+path}","compare_url":"https://api.github.com/repos/bitladen-nw/createphp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bitladen-nw/createphp/merges","archive_url":"https://api.github.com/repos/bitladen-nw/createphp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bitladen-nw/createphp/downloads","issues_url":"https://api.github.com/repos/bitladen-nw/createphp/issues{/number}","pulls_url":"https://api.github.com/repos/bitladen-nw/createphp/pulls{/number}","milestones_url":"https://api.github.com/repos/bitladen-nw/createphp/milestones{/number}","notifications_url":"https://api.github.com/repos/bitladen-nw/createphp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bitladen-nw/createphp/labels{/name}","releases_url":"https://api.github.com/repos/bitladen-nw/createphp/releases{/id}","created_at":"2015-04-24T12:25:03Z","updated_at":"2015-04-24T12:25:04Z","pushed_at":"2015-04-24T12:41:39Z","git_url":"git://github.com/bitladen-nw/createphp.git","ssh_url":"git@github.com:bitladen-nw/createphp.git","clone_url":"https://github.com/bitladen-nw/createphp.git","svn_url":"https://github.com/bitladen-nw/createphp","homepage":"","size":626,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"bitladen-nw:master","ref":"master","sha":"263f6420b0a3c739c1b299e3f302516eeb441ee9","user":{"login":"bitladen-nw","id":11576763,"avatar_url":"https://avatars.githubusercontent.com/u/11576763?v=3","gravatar_id":"","url":"https://api.github.com/users/bitladen-nw","html_url":"https://github.com/bitladen-nw","followers_url":"https://api.github.com/users/bitladen-nw/followers","following_url":"https://api.github.com/users/bitladen-nw/following{/other_user}","gists_url":"https://api.github.com/users/bitladen-nw/gists{/gist_id}","starred_url":"https://api.github.com/users/bitladen-nw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitladen-nw/subscriptions","organizations_url":"https://api.github.com/users/bitladen-nw/orgs","repos_url":"https://api.github.com/users/bitladen-nw/repos","events_url":"https://api.github.com/users/bitladen-nw/events{/privacy}","received_events_url":"https://api.github.com/users/bitladen-nw/received_events","type":"User","site_admin":false},"repo":{"id":34517293,"name":"createphp","full_name":"bitladen-nw/createphp","owner":{"login":"bitladen-nw","id":11576763,"avatar_url":"https://avatars.githubusercontent.com/u/11576763?v=3","gravatar_id":"","url":"https://api.github.com/users/bitladen-nw","html_url":"https://github.com/bitladen-nw","followers_url":"https://api.github.com/users/bitladen-nw/followers","following_url":"https://api.github.com/users/bitladen-nw/following{/other_user}","gists_url":"https://api.github.com/users/bitladen-nw/gists{/gist_id}","starred_url":"https://api.github.com/users/bitladen-nw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitladen-nw/subscriptions","organizations_url":"https://api.github.com/users/bitladen-nw/orgs","repos_url":"https://api.github.com/users/bitladen-nw/repos","events_url":"https://api.github.com/users/bitladen-nw/events{/privacy}","received_events_url":"https://api.github.com/users/bitladen-nw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bitladen-nw/createphp","description":"PHP adapter for Create.js","fork":true,"url":"https://api.github.com/repos/bitladen-nw/createphp","forks_url":"https://api.github.com/repos/bitladen-nw/createphp/forks","keys_url":"https://api.github.com/repos/bitladen-nw/createphp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bitladen-nw/createphp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bitladen-nw/createphp/teams","hooks_url":"https://api.github.com/repos/bitladen-nw/createphp/hooks","issue_events_url":"https://api.github.com/repos/bitladen-nw/createphp/issues/events{/number}","events_url":"https://api.github.com/repos/bitladen-nw/createphp/events","assignees_url":"https://api.github.com/repos/bitladen-nw/createphp/assignees{/user}","branches_url":"https://api.github.com/repos/bitladen-nw/createphp/branches{/branch}","tags_url":"https://api.github.com/repos/bitladen-nw/createphp/tags","blobs_url":"https://api.github.com/repos/bitladen-nw/createphp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bitladen-nw/createphp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bitladen-nw/createphp/git/refs{/sha}","trees_url":"https://api.github.com/repos/bitladen-nw/createphp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bitladen-nw/createphp/statuses/{sha}","languages_url":"https://api.github.com/repos/bitladen-nw/createphp/languages","stargazers_url":"https://api.github.com/repos/bitladen-nw/createphp/stargazers","contributors_url":"https://api.github.com/repos/bitladen-nw/createphp/contributors","subscribers_url":"https://api.github.com/repos/bitladen-nw/createphp/subscribers","subscription_url":"https://api.github.com/repos/bitladen-nw/createphp/subscription","commits_url":"https://api.github.com/repos/bitladen-nw/createphp/commits{/sha}","git_commits_url":"https://api.github.com/repos/bitladen-nw/createphp/git/commits{/sha}","comments_url":"https://api.github.com/repos/bitladen-nw/createphp/comments{/number}","issue_comment_url":"https://api.github.com/repos/bitladen-nw/createphp/issues/comments{/number}","contents_url":"https://api.github.com/repos/bitladen-nw/createphp/contents/{+path}","compare_url":"https://api.github.com/repos/bitladen-nw/createphp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bitladen-nw/createphp/merges","archive_url":"https://api.github.com/repos/bitladen-nw/createphp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bitladen-nw/createphp/downloads","issues_url":"https://api.github.com/repos/bitladen-nw/createphp/issues{/number}","pulls_url":"https://api.github.com/repos/bitladen-nw/createphp/pulls{/number}","milestones_url":"https://api.github.com/repos/bitladen-nw/createphp/milestones{/number}","notifications_url":"https://api.github.com/repos/bitladen-nw/createphp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bitladen-nw/createphp/labels{/name}","releases_url":"https://api.github.com/repos/bitladen-nw/createphp/releases{/id}","created_at":"2015-04-24T12:25:03Z","updated_at":"2015-04-24T12:25:04Z","pushed_at":"2015-04-24T12:41:39Z","git_url":"git://github.com/bitladen-nw/createphp.git","ssh_url":"git@github.com:bitladen-nw/createphp.git","clone_url":"https://github.com/bitladen-nw/createphp.git","svn_url":"https://github.com/bitladen-nw/createphp","homepage":"","size":626,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bitladen-nw/createphp/pulls/1"},"html":{"href":"https://github.com/bitladen-nw/createphp/pull/1"},"issue":{"href":"https://api.github.com/repos/bitladen-nw/createphp/issues/1"},"comments":{"href":"https://api.github.com/repos/bitladen-nw/createphp/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/bitladen-nw/createphp/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/bitladen-nw/createphp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bitladen-nw/createphp/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/bitladen-nw/createphp/statuses/bd53f2f3353f1d1c29ef307dc5304121d3dcd773"}}}}