{"action":"created","comment":{"url":"https://api.github.com/repos/Sylius/Sylius/pulls/comments/55196378","id":55196378,"diff_hunk":"@@ -280,33 +274,78 @@ public function countByCustomerAndPaymentState(CustomerInterface $customer, $sta\n         ;\n     }\n \n+    /**\n+     * {@inheritdoc}\n+     */\n     public function findBetweenDates(\\DateTime $from, \\DateTime $to, $state = null)\n     {\n-        $queryBuilder = $this->getCollectionQueryBuilderBetweenDates($from, $to, $state);\n+        $queryBuilder = $this->createQueryBuilder('o');\n+\n+        if (null !== $state) {\n+            $queryBuilder\n+                ->andWhere('o.state = :state')\n+                ->setParameter('state', $state)\n+            ;\n+        }\n \n         return $queryBuilder\n+            ->andWhere($queryBuilder->expr()->isNotNull('o.completedAt'))\n+            ->andWhere($queryBuilder->expr()->gte('o.createdAt', ':from'))\n+            ->andWhere($queryBuilder->expr()->lte('o.createdAt', ':to'))\n+            ->setParameter('from', $from)\n+            ->setParameter('to', $to)\n             ->getQuery()\n             ->getResult()\n         ;\n     }\n \n+    /**\n+     * {@inheritdoc}\n+     */\n     public function countBetweenDates(\\DateTime $from, \\DateTime $to, $state = null)\n     {\n-        $queryBuilder = $this->getCollectionQueryBuilderBetweenDates($from, $to, $state);\n+        $queryBuilder = $this->createQueryBuilder('o');\n+\n+        if (null !== $state) {\n+            $queryBuilder\n+                ->andWhere('o.state = :state')\n+                ->setParameter('state', $state)\n+            ;\n+        }\n \n         return $queryBuilder\n             ->select('count(o.id)')\n+            ->andWhere($queryBuilder->expr()->isNotNull('o.completedAt'))\n+            ->andWhere($queryBuilder->expr()->gte('o.createdAt', ':from'))\n+            ->andWhere($queryBuilder->expr()->lte('o.createdAt', ':to'))\n+            ->setParameter('from', $from)\n+            ->setParameter('to', $to)\n             ->getQuery()\n             ->getSingleScalarResult()\n         ;\n     }\n \n+    /**\n+     * {@inheritdoc}\n+     */\n     public function revenueBetweenDates(\\DateTime $from, \\DateTime $to, $state = null)\n     {\n-        $queryBuilder = $this->getCollectionQueryBuilderBetweenDates($from, $to, $state);\n+        $queryBuilder = $this->createQueryBuilder('o');\n+\n+        if (null !== $state) {\n+            $queryBuilder\n+                ->andWhere('o.state = :state')\n+                ->setParameter('state', $state)\n+            ;\n+        }\n \n         return $queryBuilder\n             ->select('sum(o.total)')\n+            ->andWhere($queryBuilder->expr()->isNotNull('o.completedAt'))\n+            ->andWhere($queryBuilder->expr()->gte('o.createdAt', ':from'))\n+            ->andWhere($queryBuilder->expr()->lte('o.createdAt', ':to'))\n+            ->setParameter('from', $from)\n+            ->setParameter('to', $to)","path":"src/Sylius/Bundle/CoreBundle/Doctrine/ORM/OrderRepository.php","position":227,"original_position":227,"commit_id":"30cf0ee5ac2a0518b3bf951af7790e2f0656e639","original_commit_id":"30cf0ee5ac2a0518b3bf951af7790e2f0656e639","user":{"login":"aramalipoor","id":1164589,"avatar_url":"https://avatars.githubusercontent.com/u/1164589?v=3","gravatar_id":"","url":"https://api.github.com/users/aramalipoor","html_url":"https://github.com/aramalipoor","followers_url":"https://api.github.com/users/aramalipoor/followers","following_url":"https://api.github.com/users/aramalipoor/following{/other_user}","gists_url":"https://api.github.com/users/aramalipoor/gists{/gist_id}","starred_url":"https://api.github.com/users/aramalipoor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aramalipoor/subscriptions","organizations_url":"https://api.github.com/users/aramalipoor/orgs","repos_url":"https://api.github.com/users/aramalipoor/repos","events_url":"https://api.github.com/users/aramalipoor/events{/privacy}","received_events_url":"https://api.github.com/users/aramalipoor/received_events","type":"User","site_admin":false},"body":"`$this->queryBetweenDates($from, $to)->select('SUM(o.total)')` ?","created_at":"2016-03-07T12:26:29Z","updated_at":"2016-03-07T12:26:29Z","html_url":"https://github.com/Sylius/Sylius/pull/3854#discussion_r55196378","pull_request_url":"https://api.github.com/repos/Sylius/Sylius/pulls/3854","_links":{"self":{"href":"https://api.github.com/repos/Sylius/Sylius/pulls/comments/55196378"},"html":{"href":"https://github.com/Sylius/Sylius/pull/3854#discussion_r55196378"},"pull_request":{"href":"https://api.github.com/repos/Sylius/Sylius/pulls/3854"}}},"pull_request":{"url":"https://api.github.com/repos/Sylius/Sylius/pulls/3854","id":55753795,"html_url":"https://github.com/Sylius/Sylius/pull/3854","diff_url":"https://github.com/Sylius/Sylius/pull/3854.diff","patch_url":"https://github.com/Sylius/Sylius/pull/3854.patch","issue_url":"https://api.github.com/repos/Sylius/Sylius/issues/3854","number":3854,"state":"open","locked":false,"title":"Repository clean up and TranslatableResourceRepository deletion","user":{"login":"lchrusciel","id":6213903,"avatar_url":"https://avatars.githubusercontent.com/u/6213903?v=3","gravatar_id":"","url":"https://api.github.com/users/lchrusciel","html_url":"https://github.com/lchrusciel","followers_url":"https://api.github.com/users/lchrusciel/followers","following_url":"https://api.github.com/users/lchrusciel/following{/other_user}","gists_url":"https://api.github.com/users/lchrusciel/gists{/gist_id}","starred_url":"https://api.github.com/users/lchrusciel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lchrusciel/subscriptions","organizations_url":"https://api.github.com/users/lchrusciel/orgs","repos_url":"https://api.github.com/users/lchrusciel/repos","events_url":"https://api.github.com/users/lchrusciel/events{/privacy}","received_events_url":"https://api.github.com/users/lchrusciel/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\r\n| Bug fix?      | yes\r\n| New feature?  | no\r\n| BC breaks?    | yes\r\n| Deprecations? | no\r\n| Fixed tickets | #2614\r\n| License       | MIT\r\n| Doc PR        | \r\n\r\nI've made some clean ups in repositories and introduced some new repository interfaces. Moreover, I have also removed TranslatableResourceRepository and translation fields from configuration. It will reduce amount of magic in our repositories and will result in explicit calls to them. I am aware that this is a huge BC break, but it is better to do such changes earlier than later ;) \r\n\r\n*Update*\r\n**NOTE:** In order to be as explicit as it is possible, I removed all magic methods and functions like *getQueryBuilder*. Repositories will be much more readable if we will call methods directly, where one has to declare every used join. Previous implementation was hard to maintain as some times we used some objects joined in a parent class of parent class of parent class of the class we used. This was misleading and generated enormous amount of bugs. I removed some spec also, cuz implementation of repository has been changed and it's logic is tested anyway in a behat scenarios. \r\n\r\n*Uodate2*\r\n**NOTE:** Contains changes from #4271","created_at":"2016-01-12T12:53:43Z","updated_at":"2016-03-07T12:26:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"340b9360cf914a1deeb757ba88964e84cd7e3505","assignee":null,"milestone":{"url":"https://api.github.com/repos/Sylius/Sylius/milestones/5","html_url":"https://github.com/Sylius/Sylius/milestones/v0.18.0","labels_url":"https://api.github.com/repos/Sylius/Sylius/milestones/5/labels","id":1104563,"number":5,"title":"v0.18.0","description":"Version v0.18.0 of Sylius platform.","creator":{"login":"pjedrzejewski","id":614970,"avatar_url":"https://avatars.githubusercontent.com/u/614970?v=3","gravatar_id":"","url":"https://api.github.com/users/pjedrzejewski","html_url":"https://github.com/pjedrzejewski","followers_url":"https://api.github.com/users/pjedrzejewski/followers","following_url":"https://api.github.com/users/pjedrzejewski/following{/other_user}","gists_url":"https://api.github.com/users/pjedrzejewski/gists{/gist_id}","starred_url":"https://api.github.com/users/pjedrzejewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjedrzejewski/subscriptions","organizations_url":"https://api.github.com/users/pjedrzejewski/orgs","repos_url":"https://api.github.com/users/pjedrzejewski/repos","events_url":"https://api.github.com/users/pjedrzejewski/events{/privacy}","received_events_url":"https://api.github.com/users/pjedrzejewski/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":10,"state":"open","created_at":"2015-05-11T11:10:22Z","updated_at":"2016-03-07T10:58:29Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/Sylius/Sylius/pulls/3854/commits","review_comments_url":"https://api.github.com/repos/Sylius/Sylius/pulls/3854/comments","review_comment_url":"https://api.github.com/repos/Sylius/Sylius/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Sylius/Sylius/issues/3854/comments","statuses_url":"https://api.github.com/repos/Sylius/Sylius/statuses/30cf0ee5ac2a0518b3bf951af7790e2f0656e639","head":{"label":"lchrusciel:repository-xmass-cleaning","ref":"repository-xmass-cleaning","sha":"30cf0ee5ac2a0518b3bf951af7790e2f0656e639","user":{"login":"lchrusciel","id":6213903,"avatar_url":"https://avatars.githubusercontent.com/u/6213903?v=3","gravatar_id":"","url":"https://api.github.com/users/lchrusciel","html_url":"https://github.com/lchrusciel","followers_url":"https://api.github.com/users/lchrusciel/followers","following_url":"https://api.github.com/users/lchrusciel/following{/other_user}","gists_url":"https://api.github.com/users/lchrusciel/gists{/gist_id}","starred_url":"https://api.github.com/users/lchrusciel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lchrusciel/subscriptions","organizations_url":"https://api.github.com/users/lchrusciel/orgs","repos_url":"https://api.github.com/users/lchrusciel/repos","events_url":"https://api.github.com/users/lchrusciel/events{/privacy}","received_events_url":"https://api.github.com/users/lchrusciel/received_events","type":"User","site_admin":false},"repo":{"id":27534661,"name":"Sylius","full_name":"lchrusciel/Sylius","owner":{"login":"lchrusciel","id":6213903,"avatar_url":"https://avatars.githubusercontent.com/u/6213903?v=3","gravatar_id":"","url":"https://api.github.com/users/lchrusciel","html_url":"https://github.com/lchrusciel","followers_url":"https://api.github.com/users/lchrusciel/followers","following_url":"https://api.github.com/users/lchrusciel/following{/other_user}","gists_url":"https://api.github.com/users/lchrusciel/gists{/gist_id}","starred_url":"https://api.github.com/users/lchrusciel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lchrusciel/subscriptions","organizations_url":"https://api.github.com/users/lchrusciel/orgs","repos_url":"https://api.github.com/users/lchrusciel/repos","events_url":"https://api.github.com/users/lchrusciel/events{/privacy}","received_events_url":"https://api.github.com/users/lchrusciel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lchrusciel/Sylius","description":"Modern e-commerce for PHP, based on the Symfony2 framework.","fork":true,"url":"https://api.github.com/repos/lchrusciel/Sylius","forks_url":"https://api.github.com/repos/lchrusciel/Sylius/forks","keys_url":"https://api.github.com/repos/lchrusciel/Sylius/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lchrusciel/Sylius/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lchrusciel/Sylius/teams","hooks_url":"https://api.github.com/repos/lchrusciel/Sylius/hooks","issue_events_url":"https://api.github.com/repos/lchrusciel/Sylius/issues/events{/number}","events_url":"https://api.github.com/repos/lchrusciel/Sylius/events","assignees_url":"https://api.github.com/repos/lchrusciel/Sylius/assignees{/user}","branches_url":"https://api.github.com/repos/lchrusciel/Sylius/branches{/branch}","tags_url":"https://api.github.com/repos/lchrusciel/Sylius/tags","blobs_url":"https://api.github.com/repos/lchrusciel/Sylius/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lchrusciel/Sylius/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lchrusciel/Sylius/git/refs{/sha}","trees_url":"https://api.github.com/repos/lchrusciel/Sylius/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lchrusciel/Sylius/statuses/{sha}","languages_url":"https://api.github.com/repos/lchrusciel/Sylius/languages","stargazers_url":"https://api.github.com/repos/lchrusciel/Sylius/stargazers","contributors_url":"https://api.github.com/repos/lchrusciel/Sylius/contributors","subscribers_url":"https://api.github.com/repos/lchrusciel/Sylius/subscribers","subscription_url":"https://api.github.com/repos/lchrusciel/Sylius/subscription","commits_url":"https://api.github.com/repos/lchrusciel/Sylius/commits{/sha}","git_commits_url":"https://api.github.com/repos/lchrusciel/Sylius/git/commits{/sha}","comments_url":"https://api.github.com/repos/lchrusciel/Sylius/comments{/number}","issue_comment_url":"https://api.github.com/repos/lchrusciel/Sylius/issues/comments{/number}","contents_url":"https://api.github.com/repos/lchrusciel/Sylius/contents/{+path}","compare_url":"https://api.github.com/repos/lchrusciel/Sylius/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lchrusciel/Sylius/merges","archive_url":"https://api.github.com/repos/lchrusciel/Sylius/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lchrusciel/Sylius/downloads","issues_url":"https://api.github.com/repos/lchrusciel/Sylius/issues{/number}","pulls_url":"https://api.github.com/repos/lchrusciel/Sylius/pulls{/number}","milestones_url":"https://api.github.com/repos/lchrusciel/Sylius/milestones{/number}","notifications_url":"https://api.github.com/repos/lchrusciel/Sylius/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lchrusciel/Sylius/labels{/name}","releases_url":"https://api.github.com/repos/lchrusciel/Sylius/releases{/id}","deployments_url":"https://api.github.com/repos/lchrusciel/Sylius/deployments","created_at":"2014-12-04T10:09:34Z","updated_at":"2016-01-12T07:29:40Z","pushed_at":"2016-03-07T12:08:43Z","git_url":"git://github.com/lchrusciel/Sylius.git","ssh_url":"git@github.com:lchrusciel/Sylius.git","clone_url":"https://github.com/lchrusciel/Sylius.git","svn_url":"https://github.com/lchrusciel/Sylius","homepage":"Sylius.org","size":28216,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Sylius:master","ref":"master","sha":"73281778de462321c4539f1dd94075c38b630494","user":{"login":"Sylius","id":719423,"avatar_url":"https://avatars.githubusercontent.com/u/719423?v=3","gravatar_id":"","url":"https://api.github.com/users/Sylius","html_url":"https://github.com/Sylius","followers_url":"https://api.github.com/users/Sylius/followers","following_url":"https://api.github.com/users/Sylius/following{/other_user}","gists_url":"https://api.github.com/users/Sylius/gists{/gist_id}","starred_url":"https://api.github.com/users/Sylius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sylius/subscriptions","organizations_url":"https://api.github.com/users/Sylius/orgs","repos_url":"https://api.github.com/users/Sylius/repos","events_url":"https://api.github.com/users/Sylius/events{/privacy}","received_events_url":"https://api.github.com/users/Sylius/received_events","type":"Organization","site_admin":false},"repo":{"id":2717549,"name":"Sylius","full_name":"Sylius/Sylius","owner":{"login":"Sylius","id":719423,"avatar_url":"https://avatars.githubusercontent.com/u/719423?v=3","gravatar_id":"","url":"https://api.github.com/users/Sylius","html_url":"https://github.com/Sylius","followers_url":"https://api.github.com/users/Sylius/followers","following_url":"https://api.github.com/users/Sylius/following{/other_user}","gists_url":"https://api.github.com/users/Sylius/gists{/gist_id}","starred_url":"https://api.github.com/users/Sylius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sylius/subscriptions","organizations_url":"https://api.github.com/users/Sylius/orgs","repos_url":"https://api.github.com/users/Sylius/repos","events_url":"https://api.github.com/users/Sylius/events{/privacy}","received_events_url":"https://api.github.com/users/Sylius/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Sylius/Sylius","description":"eCommerce PHP framework built on top of Symfony with component-based architecture and format-agnostic rendering. (HTML/JSON/XML)","fork":false,"url":"https://api.github.com/repos/Sylius/Sylius","forks_url":"https://api.github.com/repos/Sylius/Sylius/forks","keys_url":"https://api.github.com/repos/Sylius/Sylius/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sylius/Sylius/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sylius/Sylius/teams","hooks_url":"https://api.github.com/repos/Sylius/Sylius/hooks","issue_events_url":"https://api.github.com/repos/Sylius/Sylius/issues/events{/number}","events_url":"https://api.github.com/repos/Sylius/Sylius/events","assignees_url":"https://api.github.com/repos/Sylius/Sylius/assignees{/user}","branches_url":"https://api.github.com/repos/Sylius/Sylius/branches{/branch}","tags_url":"https://api.github.com/repos/Sylius/Sylius/tags","blobs_url":"https://api.github.com/repos/Sylius/Sylius/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sylius/Sylius/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sylius/Sylius/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sylius/Sylius/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sylius/Sylius/statuses/{sha}","languages_url":"https://api.github.com/repos/Sylius/Sylius/languages","stargazers_url":"https://api.github.com/repos/Sylius/Sylius/stargazers","contributors_url":"https://api.github.com/repos/Sylius/Sylius/contributors","subscribers_url":"https://api.github.com/repos/Sylius/Sylius/subscribers","subscription_url":"https://api.github.com/repos/Sylius/Sylius/subscription","commits_url":"https://api.github.com/repos/Sylius/Sylius/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sylius/Sylius/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sylius/Sylius/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sylius/Sylius/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sylius/Sylius/contents/{+path}","compare_url":"https://api.github.com/repos/Sylius/Sylius/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sylius/Sylius/merges","archive_url":"https://api.github.com/repos/Sylius/Sylius/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sylius/Sylius/downloads","issues_url":"https://api.github.com/repos/Sylius/Sylius/issues{/number}","pulls_url":"https://api.github.com/repos/Sylius/Sylius/pulls{/number}","milestones_url":"https://api.github.com/repos/Sylius/Sylius/milestones{/number}","notifications_url":"https://api.github.com/repos/Sylius/Sylius/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sylius/Sylius/labels{/name}","releases_url":"https://api.github.com/repos/Sylius/Sylius/releases{/id}","deployments_url":"https://api.github.com/repos/Sylius/Sylius/deployments","created_at":"2011-11-05T22:05:52Z","updated_at":"2016-03-07T12:04:54Z","pushed_at":"2016-03-07T12:08:48Z","git_url":"git://github.com/Sylius/Sylius.git","ssh_url":"git@github.com:Sylius/Sylius.git","clone_url":"https://github.com/Sylius/Sylius.git","svn_url":"https://github.com/Sylius/Sylius","homepage":"http://Sylius.org","size":59310,"stargazers_count":2197,"watchers_count":2197,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":800,"mirror_url":null,"open_issues_count":577,"forks":800,"open_issues":577,"watchers":2197,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Sylius/Sylius/pulls/3854"},"html":{"href":"https://github.com/Sylius/Sylius/pull/3854"},"issue":{"href":"https://api.github.com/repos/Sylius/Sylius/issues/3854"},"comments":{"href":"https://api.github.com/repos/Sylius/Sylius/issues/3854/comments"},"review_comments":{"href":"https://api.github.com/repos/Sylius/Sylius/pulls/3854/comments"},"review_comment":{"href":"https://api.github.com/repos/Sylius/Sylius/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Sylius/Sylius/pulls/3854/commits"},"statuses":{"href":"https://api.github.com/repos/Sylius/Sylius/statuses/30cf0ee5ac2a0518b3bf951af7790e2f0656e639"}}}}