{"action":"created","comment":{"url":"https://api.github.com/repos/nfqakademija/corvus/pulls/comments/46080394","id":46080394,"diff_hunk":"@@ -12,16 +12,108 @@\n use Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller;\n use Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Route;\n use Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Template;\n+use Corvus\\EventBundle\\Entity\\Event;\n+use Corvus\\EventBundle\\Form\\EventType;\n+use Corvus\\EventBundle\\Form\\EditEventType;\n+use Symfony\\Component\\HttpFoundation\\Request;\n use Symfony\\Component\\HttpFoundation\\Request;\n \n class DefaultController extends Controller\n {\n     /**\n+     * @Route(\"/event/new\")\n      * @Route(\"/event/{id}\")\n      * @Template()\n      */\n+    public function createEventAction(Request $request)\n     public function indexAction($id)\n     {\n+        $event = new Event();\n+        $form = $this->createForm(new EventType(), $event);\n+\n+        $form->handleRequest($request);\n+\n+        if($form->isValid()){\n+            $em = $this->getDoctrine()->getManager();\n+            $event->setHost($this->getUser());\n+            foreach($event->getEmails() as $email){\n+                $count = 0;\n+                foreach($event->getEmails() as $emailDupe){\n+                    if(strtolower($email->getEmail()) == strtolower($emailDupe->getEmail())){\n+                        $count++;\n+                    }\n+                }\n+                if($count > 1){\n+                    $event->removeEmail($email);\n+                    continue;\n+                }\n+                $user = $this->getDoctrine()->getRepository('CorvusMainBundle:User')->findOneBy(array('email' => $email->getEmail()));\n+                if($user){\n+                    $event->addUser($user);\n+                    $event->removeEmail($email);\n+                } else {\n+                    $email->setEvent($event);\n+                }\n+            }\n+            foreach($event->getEmails() as $email){\n+                $em->persist($email);","path":"src/Corvus/EventBundle/Controller/DefaultController.php","position":48,"original_position":48,"commit_id":"1b5fd2647578ad0042a212df94c3dd86b4e689f7","original_commit_id":"1b5fd2647578ad0042a212df94c3dd86b4e689f7","user":{"login":"saltenasl","id":8775140,"avatar_url":"https://avatars.githubusercontent.com/u/8775140?v=3","gravatar_id":"","url":"https://api.github.com/users/saltenasl","html_url":"https://github.com/saltenasl","followers_url":"https://api.github.com/users/saltenasl/followers","following_url":"https://api.github.com/users/saltenasl/following{/other_user}","gists_url":"https://api.github.com/users/saltenasl/gists{/gist_id}","starred_url":"https://api.github.com/users/saltenasl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saltenasl/subscriptions","organizations_url":"https://api.github.com/users/saltenasl/orgs","repos_url":"https://api.github.com/users/saltenasl/repos","events_url":"https://api.github.com/users/saltenasl/events{/privacy}","received_events_url":"https://api.github.com/users/saltenasl/received_events","type":"User","site_admin":false},"body":"if (!$em->contains($email))","created_at":"2015-11-28T14:37:54Z","updated_at":"2015-11-28T14:37:54Z","html_url":"https://github.com/nfqakademija/corvus/pull/16#discussion_r46080394","pull_request_url":"https://api.github.com/repos/nfqakademija/corvus/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/nfqakademija/corvus/pulls/comments/46080394"},"html":{"href":"https://github.com/nfqakademija/corvus/pull/16#discussion_r46080394"},"pull_request":{"href":"https://api.github.com/repos/nfqakademija/corvus/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/nfqakademija/corvus/pulls/16","id":52041576,"html_url":"https://github.com/nfqakademija/corvus/pull/16","diff_url":"https://github.com/nfqakademija/corvus/pull/16.diff","patch_url":"https://github.com/nfqakademija/corvus/pull/16.patch","issue_url":"https://api.github.com/repos/nfqakademija/corvus/issues/16","number":16,"state":"open","locked":false,"title":"Createevent2","user":{"login":"LiudasRepkovas","id":9484580,"avatar_url":"https://avatars.githubusercontent.com/u/9484580?v=3","gravatar_id":"","url":"https://api.github.com/users/LiudasRepkovas","html_url":"https://github.com/LiudasRepkovas","followers_url":"https://api.github.com/users/LiudasRepkovas/followers","following_url":"https://api.github.com/users/LiudasRepkovas/following{/other_user}","gists_url":"https://api.github.com/users/LiudasRepkovas/gists{/gist_id}","starred_url":"https://api.github.com/users/LiudasRepkovas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LiudasRepkovas/subscriptions","organizations_url":"https://api.github.com/users/LiudasRepkovas/orgs","repos_url":"https://api.github.com/users/LiudasRepkovas/repos","events_url":"https://api.github.com/users/LiudasRepkovas/events{/privacy}","received_events_url":"https://api.github.com/users/LiudasRepkovas/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-28T14:36:09Z","updated_at":"2015-11-28T14:37:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fb9322766ee21e1d1af1b40b8bc11eb77ea5dfd2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nfqakademija/corvus/pulls/16/commits","review_comments_url":"https://api.github.com/repos/nfqakademija/corvus/pulls/16/comments","review_comment_url":"https://api.github.com/repos/nfqakademija/corvus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nfqakademija/corvus/issues/16/comments","statuses_url":"https://api.github.com/repos/nfqakademija/corvus/statuses/1b5fd2647578ad0042a212df94c3dd86b4e689f7","head":{"label":"nfqakademija:createevent2","ref":"createevent2","sha":"1b5fd2647578ad0042a212df94c3dd86b4e689f7","user":{"login":"nfqakademija","id":4995607,"avatar_url":"https://avatars.githubusercontent.com/u/4995607?v=3","gravatar_id":"","url":"https://api.github.com/users/nfqakademija","html_url":"https://github.com/nfqakademija","followers_url":"https://api.github.com/users/nfqakademija/followers","following_url":"https://api.github.com/users/nfqakademija/following{/other_user}","gists_url":"https://api.github.com/users/nfqakademija/gists{/gist_id}","starred_url":"https://api.github.com/users/nfqakademija/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nfqakademija/subscriptions","organizations_url":"https://api.github.com/users/nfqakademija/orgs","repos_url":"https://api.github.com/users/nfqakademija/repos","events_url":"https://api.github.com/users/nfqakademija/events{/privacy}","received_events_url":"https://api.github.com/users/nfqakademija/received_events","type":"Organization","site_admin":false},"repo":{"id":44617857,"name":"corvus","full_name":"nfqakademija/corvus","owner":{"login":"nfqakademija","id":4995607,"avatar_url":"https://avatars.githubusercontent.com/u/4995607?v=3","gravatar_id":"","url":"https://api.github.com/users/nfqakademija","html_url":"https://github.com/nfqakademija","followers_url":"https://api.github.com/users/nfqakademija/followers","following_url":"https://api.github.com/users/nfqakademija/following{/other_user}","gists_url":"https://api.github.com/users/nfqakademija/gists{/gist_id}","starred_url":"https://api.github.com/users/nfqakademija/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nfqakademija/subscriptions","organizations_url":"https://api.github.com/users/nfqakademija/orgs","repos_url":"https://api.github.com/users/nfqakademija/repos","events_url":"https://api.github.com/users/nfqakademija/events{/privacy}","received_events_url":"https://api.github.com/users/nfqakademija/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nfqakademija/corvus","description":"","fork":false,"url":"https://api.github.com/repos/nfqakademija/corvus","forks_url":"https://api.github.com/repos/nfqakademija/corvus/forks","keys_url":"https://api.github.com/repos/nfqakademija/corvus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nfqakademija/corvus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nfqakademija/corvus/teams","hooks_url":"https://api.github.com/repos/nfqakademija/corvus/hooks","issue_events_url":"https://api.github.com/repos/nfqakademija/corvus/issues/events{/number}","events_url":"https://api.github.com/repos/nfqakademija/corvus/events","assignees_url":"https://api.github.com/repos/nfqakademija/corvus/assignees{/user}","branches_url":"https://api.github.com/repos/nfqakademija/corvus/branches{/branch}","tags_url":"https://api.github.com/repos/nfqakademija/corvus/tags","blobs_url":"https://api.github.com/repos/nfqakademija/corvus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nfqakademija/corvus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nfqakademija/corvus/git/refs{/sha}","trees_url":"https://api.github.com/repos/nfqakademija/corvus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nfqakademija/corvus/statuses/{sha}","languages_url":"https://api.github.com/repos/nfqakademija/corvus/languages","stargazers_url":"https://api.github.com/repos/nfqakademija/corvus/stargazers","contributors_url":"https://api.github.com/repos/nfqakademija/corvus/contributors","subscribers_url":"https://api.github.com/repos/nfqakademija/corvus/subscribers","subscription_url":"https://api.github.com/repos/nfqakademija/corvus/subscription","commits_url":"https://api.github.com/repos/nfqakademija/corvus/commits{/sha}","git_commits_url":"https://api.github.com/repos/nfqakademija/corvus/git/commits{/sha}","comments_url":"https://api.github.com/repos/nfqakademija/corvus/comments{/number}","issue_comment_url":"https://api.github.com/repos/nfqakademija/corvus/issues/comments{/number}","contents_url":"https://api.github.com/repos/nfqakademija/corvus/contents/{+path}","compare_url":"https://api.github.com/repos/nfqakademija/corvus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nfqakademija/corvus/merges","archive_url":"https://api.github.com/repos/nfqakademija/corvus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nfqakademija/corvus/downloads","issues_url":"https://api.github.com/repos/nfqakademija/corvus/issues{/number}","pulls_url":"https://api.github.com/repos/nfqakademija/corvus/pulls{/number}","milestones_url":"https://api.github.com/repos/nfqakademija/corvus/milestones{/number}","notifications_url":"https://api.github.com/repos/nfqakademija/corvus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nfqakademija/corvus/labels{/name}","releases_url":"https://api.github.com/repos/nfqakademija/corvus/releases{/id}","created_at":"2015-10-20T15:59:47Z","updated_at":"2015-11-01T13:00:26Z","pushed_at":"2015-11-28T14:36:09Z","git_url":"git://github.com/nfqakademija/corvus.git","ssh_url":"git@github.com:nfqakademija/corvus.git","clone_url":"https://github.com/nfqakademija/corvus.git","svn_url":"https://github.com/nfqakademija/corvus","homepage":null,"size":2405,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"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":"nfqakademija:develop","ref":"develop","sha":"a31e6f1457fe0452eaa3a28407f882a70a3303d7","user":{"login":"nfqakademija","id":4995607,"avatar_url":"https://avatars.githubusercontent.com/u/4995607?v=3","gravatar_id":"","url":"https://api.github.com/users/nfqakademija","html_url":"https://github.com/nfqakademija","followers_url":"https://api.github.com/users/nfqakademija/followers","following_url":"https://api.github.com/users/nfqakademija/following{/other_user}","gists_url":"https://api.github.com/users/nfqakademija/gists{/gist_id}","starred_url":"https://api.github.com/users/nfqakademija/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nfqakademija/subscriptions","organizations_url":"https://api.github.com/users/nfqakademija/orgs","repos_url":"https://api.github.com/users/nfqakademija/repos","events_url":"https://api.github.com/users/nfqakademija/events{/privacy}","received_events_url":"https://api.github.com/users/nfqakademija/received_events","type":"Organization","site_admin":false},"repo":{"id":44617857,"name":"corvus","full_name":"nfqakademija/corvus","owner":{"login":"nfqakademija","id":4995607,"avatar_url":"https://avatars.githubusercontent.com/u/4995607?v=3","gravatar_id":"","url":"https://api.github.com/users/nfqakademija","html_url":"https://github.com/nfqakademija","followers_url":"https://api.github.com/users/nfqakademija/followers","following_url":"https://api.github.com/users/nfqakademija/following{/other_user}","gists_url":"https://api.github.com/users/nfqakademija/gists{/gist_id}","starred_url":"https://api.github.com/users/nfqakademija/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nfqakademija/subscriptions","organizations_url":"https://api.github.com/users/nfqakademija/orgs","repos_url":"https://api.github.com/users/nfqakademija/repos","events_url":"https://api.github.com/users/nfqakademija/events{/privacy}","received_events_url":"https://api.github.com/users/nfqakademija/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nfqakademija/corvus","description":"","fork":false,"url":"https://api.github.com/repos/nfqakademija/corvus","forks_url":"https://api.github.com/repos/nfqakademija/corvus/forks","keys_url":"https://api.github.com/repos/nfqakademija/corvus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nfqakademija/corvus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nfqakademija/corvus/teams","hooks_url":"https://api.github.com/repos/nfqakademija/corvus/hooks","issue_events_url":"https://api.github.com/repos/nfqakademija/corvus/issues/events{/number}","events_url":"https://api.github.com/repos/nfqakademija/corvus/events","assignees_url":"https://api.github.com/repos/nfqakademija/corvus/assignees{/user}","branches_url":"https://api.github.com/repos/nfqakademija/corvus/branches{/branch}","tags_url":"https://api.github.com/repos/nfqakademija/corvus/tags","blobs_url":"https://api.github.com/repos/nfqakademija/corvus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nfqakademija/corvus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nfqakademija/corvus/git/refs{/sha}","trees_url":"https://api.github.com/repos/nfqakademija/corvus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nfqakademija/corvus/statuses/{sha}","languages_url":"https://api.github.com/repos/nfqakademija/corvus/languages","stargazers_url":"https://api.github.com/repos/nfqakademija/corvus/stargazers","contributors_url":"https://api.github.com/repos/nfqakademija/corvus/contributors","subscribers_url":"https://api.github.com/repos/nfqakademija/corvus/subscribers","subscription_url":"https://api.github.com/repos/nfqakademija/corvus/subscription","commits_url":"https://api.github.com/repos/nfqakademija/corvus/commits{/sha}","git_commits_url":"https://api.github.com/repos/nfqakademija/corvus/git/commits{/sha}","comments_url":"https://api.github.com/repos/nfqakademija/corvus/comments{/number}","issue_comment_url":"https://api.github.com/repos/nfqakademija/corvus/issues/comments{/number}","contents_url":"https://api.github.com/repos/nfqakademija/corvus/contents/{+path}","compare_url":"https://api.github.com/repos/nfqakademija/corvus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nfqakademija/corvus/merges","archive_url":"https://api.github.com/repos/nfqakademija/corvus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nfqakademija/corvus/downloads","issues_url":"https://api.github.com/repos/nfqakademija/corvus/issues{/number}","pulls_url":"https://api.github.com/repos/nfqakademija/corvus/pulls{/number}","milestones_url":"https://api.github.com/repos/nfqakademija/corvus/milestones{/number}","notifications_url":"https://api.github.com/repos/nfqakademija/corvus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nfqakademija/corvus/labels{/name}","releases_url":"https://api.github.com/repos/nfqakademija/corvus/releases{/id}","created_at":"2015-10-20T15:59:47Z","updated_at":"2015-11-01T13:00:26Z","pushed_at":"2015-11-28T14:36:09Z","git_url":"git://github.com/nfqakademija/corvus.git","ssh_url":"git@github.com:nfqakademija/corvus.git","clone_url":"https://github.com/nfqakademija/corvus.git","svn_url":"https://github.com/nfqakademija/corvus","homepage":null,"size":2405,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"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/nfqakademija/corvus/pulls/16"},"html":{"href":"https://github.com/nfqakademija/corvus/pull/16"},"issue":{"href":"https://api.github.com/repos/nfqakademija/corvus/issues/16"},"comments":{"href":"https://api.github.com/repos/nfqakademija/corvus/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/nfqakademija/corvus/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/nfqakademija/corvus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nfqakademija/corvus/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/nfqakademija/corvus/statuses/1b5fd2647578ad0042a212df94c3dd86b4e689f7"}}}}