{"action":"created","comment":{"url":"https://api.github.com/repos/sulu-io/sulu/pulls/comments/36855356","id":36855356,"diff_hunk":"@@ -232,12 +238,56 @@ private function initOrm()\n \n         $this->em->persist($category2);\n \n+        $this->initAvatar();\n+        $contact->setAvatar($this->avatar);\n+\n         $this->em->flush();\n \n         $this->contactTitle = $title;\n         $this->contactPosition = $position;\n     }\n \n+    public function initAvatar()\n+    {\n+        $collectionType = new CollectionType();\n+        $collectionType->setName('My collection type');\n+        $this->em->persist($collectionType);\n+\n+        $collection = new Collection();\n+        $collection->setType($collectionType);\n+        $this->em->persist($collection);\n+\n+        $imageType = new MediaType();\n+        $imageType->setName('image');\n+        $imageType->setDescription('This is an image');\n+        $this->em->persist($imageType);\n+\n+        $file = new File();\n+        $file->setVersion(1);\n+\n+        $fileVersion = new FileVersion();\n+        $fileVersion->setVersion(1);\n+        $fileVersion->setName('avatar.jpeg');\n+        $fileVersion->setMimeType('image/jpg');\n+        $fileVersion->setFile($file);\n+        $fileVersion->setSize(1124214);\n+        $fileVersion->setDownloadCounter(2);\n+        $fileVersion->setChanged(new \\DateTime('1937-04-20'));\n+        $fileVersion->setCreated(new \\DateTime('1937-04-20'));\n+        $file->addFileVersion($fileVersion);\n+        $this->em->persist($fileVersion);\n+\n+        $avatar = new Media();\n+        $avatar->setType($imageType);\n+        $avatar->setCollection($collection);\n+        $avatar->addFile($file);\n+        $file->setMedia($avatar);\n+        $this->em->persist($avatar);\n+        $this->em->persist($file);\n+\n+        $this->avatar = $avatar;","path":"src/Sulu/Bundle/ContactBundle/Tests/Functional/Controller/ContactControllerTest.php","position":71,"original_position":71,"commit_id":"b923e58120ef7de30729237e2812a135a26b57d4","original_commit_id":"b923e58120ef7de30729237e2812a135a26b57d4","user":{"login":"danrot","id":405874,"avatar_url":"https://avatars.githubusercontent.com/u/405874?v=3","gravatar_id":"","url":"https://api.github.com/users/danrot","html_url":"https://github.com/danrot","followers_url":"https://api.github.com/users/danrot/followers","following_url":"https://api.github.com/users/danrot/following{/other_user}","gists_url":"https://api.github.com/users/danrot/gists{/gist_id}","starred_url":"https://api.github.com/users/danrot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danrot/subscriptions","organizations_url":"https://api.github.com/users/danrot/orgs","repos_url":"https://api.github.com/users/danrot/repos","events_url":"https://api.github.com/users/danrot/events{/privacy}","received_events_url":"https://api.github.com/users/danrot/received_events","type":"User","site_admin":false},"body":"Just use `$this->avatar` immediately, instead of creating another variable.","created_at":"2015-08-12T12:52:17Z","updated_at":"2015-08-12T12:52:17Z","html_url":"https://github.com/sulu-io/sulu/pull/1472#discussion_r36855356","pull_request_url":"https://api.github.com/repos/sulu-io/sulu/pulls/1472","_links":{"self":{"href":"https://api.github.com/repos/sulu-io/sulu/pulls/comments/36855356"},"html":{"href":"https://github.com/sulu-io/sulu/pull/1472#discussion_r36855356"},"pull_request":{"href":"https://api.github.com/repos/sulu-io/sulu/pulls/1472"}}},"pull_request":{"url":"https://api.github.com/repos/sulu-io/sulu/pulls/1472","id":42124166,"html_url":"https://github.com/sulu-io/sulu/pull/1472","diff_url":"https://github.com/sulu-io/sulu/pull/1472.diff","patch_url":"https://github.com/sulu-io/sulu/pull/1472.patch","issue_url":"https://api.github.com/repos/sulu-io/sulu/issues/1472","number":1472,"state":"open","locked":false,"title":"Rest-Api support for contact-avatar","user":{"login":"marcelmoosbrugger","id":1998663,"avatar_url":"https://avatars.githubusercontent.com/u/1998663?v=3","gravatar_id":"","url":"https://api.github.com/users/marcelmoosbrugger","html_url":"https://github.com/marcelmoosbrugger","followers_url":"https://api.github.com/users/marcelmoosbrugger/followers","following_url":"https://api.github.com/users/marcelmoosbrugger/following{/other_user}","gists_url":"https://api.github.com/users/marcelmoosbrugger/gists{/gist_id}","starred_url":"https://api.github.com/users/marcelmoosbrugger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcelmoosbrugger/subscriptions","organizations_url":"https://api.github.com/users/marcelmoosbrugger/orgs","repos_url":"https://api.github.com/users/marcelmoosbrugger/repos","events_url":"https://api.github.com/users/marcelmoosbrugger/events{/privacy}","received_events_url":"https://api.github.com/users/marcelmoosbrugger/received_events","type":"User","site_admin":false},"body":"Implement Rest-Api actions for the contact avatar\r\n\r\n__tasks:__\r\n\r\n- [ ] gather feedback for my changes\r\n- [x] test coverage\r\n- [x] Extend relational model\r\n- [x] Adapt Contact Api-Class\r\n- [x] get and cget-action\r\n- [x] put and post action\r\n\r\n__informations:__\r\n\r\n| q                | a\r\n| ---------------- | ---\r\n| Fixed tickets    | none\r\n| BC breaks        | none\r\n| Documentation PR | none","created_at":"2015-08-11T12:41:59Z","updated_at":"2015-08-12T12:52:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6a40586ac798f1c890eabe4a361e4f3a96fa4000","assignee":{"login":"danrot","id":405874,"avatar_url":"https://avatars.githubusercontent.com/u/405874?v=3","gravatar_id":"","url":"https://api.github.com/users/danrot","html_url":"https://github.com/danrot","followers_url":"https://api.github.com/users/danrot/followers","following_url":"https://api.github.com/users/danrot/following{/other_user}","gists_url":"https://api.github.com/users/danrot/gists{/gist_id}","starred_url":"https://api.github.com/users/danrot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danrot/subscriptions","organizations_url":"https://api.github.com/users/danrot/orgs","repos_url":"https://api.github.com/users/danrot/repos","events_url":"https://api.github.com/users/danrot/events{/privacy}","received_events_url":"https://api.github.com/users/danrot/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/sulu-io/sulu/pulls/1472/commits","review_comments_url":"https://api.github.com/repos/sulu-io/sulu/pulls/1472/comments","review_comment_url":"https://api.github.com/repos/sulu-io/sulu/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sulu-io/sulu/issues/1472/comments","statuses_url":"https://api.github.com/repos/sulu-io/sulu/statuses/b923e58120ef7de30729237e2812a135a26b57d4","head":{"label":"sulu-io:feature/contact-thumbnails","ref":"feature/contact-thumbnails","sha":"b923e58120ef7de30729237e2812a135a26b57d4","user":{"login":"sulu-io","id":5717006,"avatar_url":"https://avatars.githubusercontent.com/u/5717006?v=3","gravatar_id":"","url":"https://api.github.com/users/sulu-io","html_url":"https://github.com/sulu-io","followers_url":"https://api.github.com/users/sulu-io/followers","following_url":"https://api.github.com/users/sulu-io/following{/other_user}","gists_url":"https://api.github.com/users/sulu-io/gists{/gist_id}","starred_url":"https://api.github.com/users/sulu-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sulu-io/subscriptions","organizations_url":"https://api.github.com/users/sulu-io/orgs","repos_url":"https://api.github.com/users/sulu-io/repos","events_url":"https://api.github.com/users/sulu-io/events{/privacy}","received_events_url":"https://api.github.com/users/sulu-io/received_events","type":"Organization","site_admin":false},"repo":{"id":13678015,"name":"sulu","full_name":"sulu-io/sulu","owner":{"login":"sulu-io","id":5717006,"avatar_url":"https://avatars.githubusercontent.com/u/5717006?v=3","gravatar_id":"","url":"https://api.github.com/users/sulu-io","html_url":"https://github.com/sulu-io","followers_url":"https://api.github.com/users/sulu-io/followers","following_url":"https://api.github.com/users/sulu-io/following{/other_user}","gists_url":"https://api.github.com/users/sulu-io/gists{/gist_id}","starred_url":"https://api.github.com/users/sulu-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sulu-io/subscriptions","organizations_url":"https://api.github.com/users/sulu-io/orgs","repos_url":"https://api.github.com/users/sulu-io/repos","events_url":"https://api.github.com/users/sulu-io/events{/privacy}","received_events_url":"https://api.github.com/users/sulu-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sulu-io/sulu","description":"Sulu core bundles & components","fork":false,"url":"https://api.github.com/repos/sulu-io/sulu","forks_url":"https://api.github.com/repos/sulu-io/sulu/forks","keys_url":"https://api.github.com/repos/sulu-io/sulu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sulu-io/sulu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sulu-io/sulu/teams","hooks_url":"https://api.github.com/repos/sulu-io/sulu/hooks","issue_events_url":"https://api.github.com/repos/sulu-io/sulu/issues/events{/number}","events_url":"https://api.github.com/repos/sulu-io/sulu/events","assignees_url":"https://api.github.com/repos/sulu-io/sulu/assignees{/user}","branches_url":"https://api.github.com/repos/sulu-io/sulu/branches{/branch}","tags_url":"https://api.github.com/repos/sulu-io/sulu/tags","blobs_url":"https://api.github.com/repos/sulu-io/sulu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sulu-io/sulu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sulu-io/sulu/git/refs{/sha}","trees_url":"https://api.github.com/repos/sulu-io/sulu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sulu-io/sulu/statuses/{sha}","languages_url":"https://api.github.com/repos/sulu-io/sulu/languages","stargazers_url":"https://api.github.com/repos/sulu-io/sulu/stargazers","contributors_url":"https://api.github.com/repos/sulu-io/sulu/contributors","subscribers_url":"https://api.github.com/repos/sulu-io/sulu/subscribers","subscription_url":"https://api.github.com/repos/sulu-io/sulu/subscription","commits_url":"https://api.github.com/repos/sulu-io/sulu/commits{/sha}","git_commits_url":"https://api.github.com/repos/sulu-io/sulu/git/commits{/sha}","comments_url":"https://api.github.com/repos/sulu-io/sulu/comments{/number}","issue_comment_url":"https://api.github.com/repos/sulu-io/sulu/issues/comments{/number}","contents_url":"https://api.github.com/repos/sulu-io/sulu/contents/{+path}","compare_url":"https://api.github.com/repos/sulu-io/sulu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sulu-io/sulu/merges","archive_url":"https://api.github.com/repos/sulu-io/sulu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sulu-io/sulu/downloads","issues_url":"https://api.github.com/repos/sulu-io/sulu/issues{/number}","pulls_url":"https://api.github.com/repos/sulu-io/sulu/pulls{/number}","milestones_url":"https://api.github.com/repos/sulu-io/sulu/milestones{/number}","notifications_url":"https://api.github.com/repos/sulu-io/sulu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sulu-io/sulu/labels{/name}","releases_url":"https://api.github.com/repos/sulu-io/sulu/releases{/id}","created_at":"2013-10-18T12:57:02Z","updated_at":"2015-07-31T15:21:59Z","pushed_at":"2015-08-12T11:54:02Z","git_url":"git://github.com/sulu-io/sulu.git","ssh_url":"git@github.com:sulu-io/sulu.git","clone_url":"https://github.com/sulu-io/sulu.git","svn_url":"https://github.com/sulu-io/sulu","homepage":"sulu.io","size":63709,"stargazers_count":60,"watchers_count":60,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":331,"forks":15,"open_issues":331,"watchers":60,"default_branch":"develop"}},"base":{"label":"sulu-io:develop","ref":"develop","sha":"191901cb441189b5e92ac4e001c6ec0722605832","user":{"login":"sulu-io","id":5717006,"avatar_url":"https://avatars.githubusercontent.com/u/5717006?v=3","gravatar_id":"","url":"https://api.github.com/users/sulu-io","html_url":"https://github.com/sulu-io","followers_url":"https://api.github.com/users/sulu-io/followers","following_url":"https://api.github.com/users/sulu-io/following{/other_user}","gists_url":"https://api.github.com/users/sulu-io/gists{/gist_id}","starred_url":"https://api.github.com/users/sulu-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sulu-io/subscriptions","organizations_url":"https://api.github.com/users/sulu-io/orgs","repos_url":"https://api.github.com/users/sulu-io/repos","events_url":"https://api.github.com/users/sulu-io/events{/privacy}","received_events_url":"https://api.github.com/users/sulu-io/received_events","type":"Organization","site_admin":false},"repo":{"id":13678015,"name":"sulu","full_name":"sulu-io/sulu","owner":{"login":"sulu-io","id":5717006,"avatar_url":"https://avatars.githubusercontent.com/u/5717006?v=3","gravatar_id":"","url":"https://api.github.com/users/sulu-io","html_url":"https://github.com/sulu-io","followers_url":"https://api.github.com/users/sulu-io/followers","following_url":"https://api.github.com/users/sulu-io/following{/other_user}","gists_url":"https://api.github.com/users/sulu-io/gists{/gist_id}","starred_url":"https://api.github.com/users/sulu-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sulu-io/subscriptions","organizations_url":"https://api.github.com/users/sulu-io/orgs","repos_url":"https://api.github.com/users/sulu-io/repos","events_url":"https://api.github.com/users/sulu-io/events{/privacy}","received_events_url":"https://api.github.com/users/sulu-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sulu-io/sulu","description":"Sulu core bundles & components","fork":false,"url":"https://api.github.com/repos/sulu-io/sulu","forks_url":"https://api.github.com/repos/sulu-io/sulu/forks","keys_url":"https://api.github.com/repos/sulu-io/sulu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sulu-io/sulu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sulu-io/sulu/teams","hooks_url":"https://api.github.com/repos/sulu-io/sulu/hooks","issue_events_url":"https://api.github.com/repos/sulu-io/sulu/issues/events{/number}","events_url":"https://api.github.com/repos/sulu-io/sulu/events","assignees_url":"https://api.github.com/repos/sulu-io/sulu/assignees{/user}","branches_url":"https://api.github.com/repos/sulu-io/sulu/branches{/branch}","tags_url":"https://api.github.com/repos/sulu-io/sulu/tags","blobs_url":"https://api.github.com/repos/sulu-io/sulu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sulu-io/sulu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sulu-io/sulu/git/refs{/sha}","trees_url":"https://api.github.com/repos/sulu-io/sulu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sulu-io/sulu/statuses/{sha}","languages_url":"https://api.github.com/repos/sulu-io/sulu/languages","stargazers_url":"https://api.github.com/repos/sulu-io/sulu/stargazers","contributors_url":"https://api.github.com/repos/sulu-io/sulu/contributors","subscribers_url":"https://api.github.com/repos/sulu-io/sulu/subscribers","subscription_url":"https://api.github.com/repos/sulu-io/sulu/subscription","commits_url":"https://api.github.com/repos/sulu-io/sulu/commits{/sha}","git_commits_url":"https://api.github.com/repos/sulu-io/sulu/git/commits{/sha}","comments_url":"https://api.github.com/repos/sulu-io/sulu/comments{/number}","issue_comment_url":"https://api.github.com/repos/sulu-io/sulu/issues/comments{/number}","contents_url":"https://api.github.com/repos/sulu-io/sulu/contents/{+path}","compare_url":"https://api.github.com/repos/sulu-io/sulu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sulu-io/sulu/merges","archive_url":"https://api.github.com/repos/sulu-io/sulu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sulu-io/sulu/downloads","issues_url":"https://api.github.com/repos/sulu-io/sulu/issues{/number}","pulls_url":"https://api.github.com/repos/sulu-io/sulu/pulls{/number}","milestones_url":"https://api.github.com/repos/sulu-io/sulu/milestones{/number}","notifications_url":"https://api.github.com/repos/sulu-io/sulu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sulu-io/sulu/labels{/name}","releases_url":"https://api.github.com/repos/sulu-io/sulu/releases{/id}","created_at":"2013-10-18T12:57:02Z","updated_at":"2015-07-31T15:21:59Z","pushed_at":"2015-08-12T11:54:02Z","git_url":"git://github.com/sulu-io/sulu.git","ssh_url":"git@github.com:sulu-io/sulu.git","clone_url":"https://github.com/sulu-io/sulu.git","svn_url":"https://github.com/sulu-io/sulu","homepage":"sulu.io","size":63709,"stargazers_count":60,"watchers_count":60,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":331,"forks":15,"open_issues":331,"watchers":60,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/sulu-io/sulu/pulls/1472"},"html":{"href":"https://github.com/sulu-io/sulu/pull/1472"},"issue":{"href":"https://api.github.com/repos/sulu-io/sulu/issues/1472"},"comments":{"href":"https://api.github.com/repos/sulu-io/sulu/issues/1472/comments"},"review_comments":{"href":"https://api.github.com/repos/sulu-io/sulu/pulls/1472/comments"},"review_comment":{"href":"https://api.github.com/repos/sulu-io/sulu/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sulu-io/sulu/pulls/1472/commits"},"statuses":{"href":"https://api.github.com/repos/sulu-io/sulu/statuses/b923e58120ef7de30729237e2812a135a26b57d4"}}}}