{"action":"created","comment":{"url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/pulls/comments/32732198","id":32732198,"diff_hunk":"@@ -0,0 +1,177 @@\n+<?php\n+\n+namespace Message\\Mothership\\Ecommerce\\Filter;\n+\n+use Message\\Cog\\DB\\QueryBuilderInterface;\n+use Message\\Mothership\\CMS\\Page\\Filter\\AbstractContentFilter;\n+use Message\\Mothership\\Commerce\\Product\\Unit\\Loader as UnitLoader;\n+use Message\\Mothership\\CMS\\Page\\Filter\\ContentFilter;\n+use Message\\Cog\\DB\\QueryBuilderFactory;\n+\n+/**\n+ * @author Samuel Trangmar-Keates\n+ *\n+ * Sale filter class for the PageLoader. Filters the results to only show pages\n+ * for products in the sale.\n+ */\n+class SaleFilter extends AbstractContentFilter\n+{\n+\tprotected $_productGroup      = 'product';\n+\tprotected $_productFieldName  = 'product';\n+\tprotected $_optionFieldName   = 'option';\n+\n+\tprotected $_unitLoader;\n+\tprotected $_queryBuilderFactory;\n+\n+\t/**\n+\t * {@inheritDocs}\n+\t * \n+\t * @param UnitLoader          $unitLoader          Used to load sale Units\n+\t * @param QueryBuilderFactory $queryBuilderFactory Required for sub-queries on the filter step\n+\t */\n+\tpublic function __construct($name, $displayName, UnitLoader $unitLoader, QueryBuilderFactory $queryBuilderFactory)\n+\t{\n+\t\tparent::__construct($name, $displayName);\n+\n+\t\t$this->_unitLoader =  $unitLoader;\n+\t\t$this->_queryBuilderFactory = $queryBuilderFactory;\n+\t}\n+\n+\t/**\n+\t * Sets the group to check, defaults to product\n+\t */\n+\tpublic function setGroup($group)\n+\t{\n+\t\t$this->_productGroup = $group;\n+\n+\t\treturn $this;\n+\t}\n+\n+\t/**\n+\t * Sets the name of the field to check for the product\n+\t */\n+\tpublic function setProductField($field)\n+\t{\n+\t\t$this->_productFieldName = $field;","path":"src/Filter/SaleFilter.php","position":55,"original_position":55,"commit_id":"6e22fb77a00913396e0c890910903d4b289cf0c4","original_commit_id":"6e22fb77a00913396e0c890910903d4b289cf0c4","user":{"login":"thomasjthomasj","id":4520924,"avatar_url":"https://avatars.githubusercontent.com/u/4520924?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasjthomasj","html_url":"https://github.com/thomasjthomasj","followers_url":"https://api.github.com/users/thomasjthomasj/followers","following_url":"https://api.github.com/users/thomasjthomasj/following{/other_user}","gists_url":"https://api.github.com/users/thomasjthomasj/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasjthomasj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasjthomasj/subscriptions","organizations_url":"https://api.github.com/users/thomasjthomasj/orgs","repos_url":"https://api.github.com/users/thomasjthomasj/repos","events_url":"https://api.github.com/users/thomasjthomasj/events{/privacy}","received_events_url":"https://api.github.com/users/thomasjthomasj/received_events","type":"User","site_admin":false},"body":"Please throw exception if not a string","created_at":"2015-06-18T14:00:14Z","updated_at":"2015-06-18T14:00:14Z","html_url":"https://github.com/mothership-ec/cog-mothership-ecommerce/pull/249#discussion_r32732198","pull_request_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/pulls/249","_links":{"self":{"href":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/pulls/comments/32732198"},"html":{"href":"https://github.com/mothership-ec/cog-mothership-ecommerce/pull/249#discussion_r32732198"},"pull_request":{"href":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/pulls/249"}}},"pull_request":{"url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/pulls/249","id":37673757,"html_url":"https://github.com/mothership-ec/cog-mothership-ecommerce/pull/249","diff_url":"https://github.com/mothership-ec/cog-mothership-ecommerce/pull/249.diff","patch_url":"https://github.com/mothership-ec/cog-mothership-ecommerce/pull/249.patch","issue_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/issues/249","number":249,"state":"open","locked":false,"title":"Sale filter","user":{"login":"kuiche","id":5089510,"avatar_url":"https://avatars.githubusercontent.com/u/5089510?v=3","gravatar_id":"","url":"https://api.github.com/users/kuiche","html_url":"https://github.com/kuiche","followers_url":"https://api.github.com/users/kuiche/followers","following_url":"https://api.github.com/users/kuiche/following{/other_user}","gists_url":"https://api.github.com/users/kuiche/gists{/gist_id}","starred_url":"https://api.github.com/users/kuiche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuiche/subscriptions","organizations_url":"https://api.github.com/users/kuiche/orgs","repos_url":"https://api.github.com/users/kuiche/repos","events_url":"https://api.github.com/users/kuiche/events{/privacy}","received_events_url":"https://api.github.com/users/kuiche/received_events","type":"User","site_admin":false},"body":"Filters pages which have products in the sale assigned to them. Products are defined as being on sale by having a lower retail than rrp price. This filter requires https://github.com/mothership-ec/cog-mothership-commerce/pull/443.","created_at":"2015-06-15T09:39:52Z","updated_at":"2015-06-18T14:00:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae491b3bf5e49ca510fe3c28e2d7ae2ce8a1001c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/pulls/249/commits","review_comments_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/pulls/249/comments","review_comment_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/issues/249/comments","statuses_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/statuses/6e22fb77a00913396e0c890910903d4b289cf0c4","head":{"label":"mothership-ec:feature/sale-filter","ref":"feature/sale-filter","sha":"6e22fb77a00913396e0c890910903d4b289cf0c4","user":{"login":"mothership-ec","id":10222458,"avatar_url":"https://avatars.githubusercontent.com/u/10222458?v=3","gravatar_id":"","url":"https://api.github.com/users/mothership-ec","html_url":"https://github.com/mothership-ec","followers_url":"https://api.github.com/users/mothership-ec/followers","following_url":"https://api.github.com/users/mothership-ec/following{/other_user}","gists_url":"https://api.github.com/users/mothership-ec/gists{/gist_id}","starred_url":"https://api.github.com/users/mothership-ec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mothership-ec/subscriptions","organizations_url":"https://api.github.com/users/mothership-ec/orgs","repos_url":"https://api.github.com/users/mothership-ec/repos","events_url":"https://api.github.com/users/mothership-ec/events{/privacy}","received_events_url":"https://api.github.com/users/mothership-ec/received_events","type":"Organization","site_admin":false},"repo":{"id":11577941,"name":"cog-mothership-ecommerce","full_name":"mothership-ec/cog-mothership-ecommerce","owner":{"login":"mothership-ec","id":10222458,"avatar_url":"https://avatars.githubusercontent.com/u/10222458?v=3","gravatar_id":"","url":"https://api.github.com/users/mothership-ec","html_url":"https://github.com/mothership-ec","followers_url":"https://api.github.com/users/mothership-ec/followers","following_url":"https://api.github.com/users/mothership-ec/following{/other_user}","gists_url":"https://api.github.com/users/mothership-ec/gists{/gist_id}","starred_url":"https://api.github.com/users/mothership-ec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mothership-ec/subscriptions","organizations_url":"https://api.github.com/users/mothership-ec/orgs","repos_url":"https://api.github.com/users/mothership-ec/repos","events_url":"https://api.github.com/users/mothership-ec/events{/privacy}","received_events_url":"https://api.github.com/users/mothership-ec/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mothership-ec/cog-mothership-ecommerce","description":"Mothership E-Commerce","fork":false,"url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce","forks_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/forks","keys_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/teams","hooks_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/hooks","issue_events_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/issues/events{/number}","events_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/events","assignees_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/assignees{/user}","branches_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/branches{/branch}","tags_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/tags","blobs_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/git/refs{/sha}","trees_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/statuses/{sha}","languages_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/languages","stargazers_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/stargazers","contributors_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/contributors","subscribers_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/subscribers","subscription_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/subscription","commits_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/commits{/sha}","git_commits_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/git/commits{/sha}","comments_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/comments{/number}","issue_comment_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/issues/comments{/number}","contents_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/contents/{+path}","compare_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/merges","archive_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/downloads","issues_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/issues{/number}","pulls_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/pulls{/number}","milestones_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/milestones{/number}","notifications_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/labels{/name}","releases_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/releases{/id}","created_at":"2013-07-22T09:42:30Z","updated_at":"2015-04-27T16:06:04Z","pushed_at":"2015-06-18T13:17:55Z","git_url":"git://github.com/mothership-ec/cog-mothership-ecommerce.git","ssh_url":"git@github.com:mothership-ec/cog-mothership-ecommerce.git","clone_url":"https://github.com/mothership-ec/cog-mothership-ecommerce.git","svn_url":"https://github.com/mothership-ec/cog-mothership-ecommerce","homepage":null,"size":4080,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":55,"forks":1,"open_issues":55,"watchers":2,"default_branch":"develop"}},"base":{"label":"mothership-ec:develop","ref":"develop","sha":"cdd41f289680d70b9dd4597049055d70bbf28024","user":{"login":"mothership-ec","id":10222458,"avatar_url":"https://avatars.githubusercontent.com/u/10222458?v=3","gravatar_id":"","url":"https://api.github.com/users/mothership-ec","html_url":"https://github.com/mothership-ec","followers_url":"https://api.github.com/users/mothership-ec/followers","following_url":"https://api.github.com/users/mothership-ec/following{/other_user}","gists_url":"https://api.github.com/users/mothership-ec/gists{/gist_id}","starred_url":"https://api.github.com/users/mothership-ec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mothership-ec/subscriptions","organizations_url":"https://api.github.com/users/mothership-ec/orgs","repos_url":"https://api.github.com/users/mothership-ec/repos","events_url":"https://api.github.com/users/mothership-ec/events{/privacy}","received_events_url":"https://api.github.com/users/mothership-ec/received_events","type":"Organization","site_admin":false},"repo":{"id":11577941,"name":"cog-mothership-ecommerce","full_name":"mothership-ec/cog-mothership-ecommerce","owner":{"login":"mothership-ec","id":10222458,"avatar_url":"https://avatars.githubusercontent.com/u/10222458?v=3","gravatar_id":"","url":"https://api.github.com/users/mothership-ec","html_url":"https://github.com/mothership-ec","followers_url":"https://api.github.com/users/mothership-ec/followers","following_url":"https://api.github.com/users/mothership-ec/following{/other_user}","gists_url":"https://api.github.com/users/mothership-ec/gists{/gist_id}","starred_url":"https://api.github.com/users/mothership-ec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mothership-ec/subscriptions","organizations_url":"https://api.github.com/users/mothership-ec/orgs","repos_url":"https://api.github.com/users/mothership-ec/repos","events_url":"https://api.github.com/users/mothership-ec/events{/privacy}","received_events_url":"https://api.github.com/users/mothership-ec/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mothership-ec/cog-mothership-ecommerce","description":"Mothership E-Commerce","fork":false,"url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce","forks_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/forks","keys_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/teams","hooks_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/hooks","issue_events_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/issues/events{/number}","events_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/events","assignees_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/assignees{/user}","branches_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/branches{/branch}","tags_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/tags","blobs_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/git/refs{/sha}","trees_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/statuses/{sha}","languages_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/languages","stargazers_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/stargazers","contributors_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/contributors","subscribers_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/subscribers","subscription_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/subscription","commits_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/commits{/sha}","git_commits_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/git/commits{/sha}","comments_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/comments{/number}","issue_comment_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/issues/comments{/number}","contents_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/contents/{+path}","compare_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/merges","archive_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/downloads","issues_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/issues{/number}","pulls_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/pulls{/number}","milestones_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/milestones{/number}","notifications_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/labels{/name}","releases_url":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/releases{/id}","created_at":"2013-07-22T09:42:30Z","updated_at":"2015-04-27T16:06:04Z","pushed_at":"2015-06-18T13:17:55Z","git_url":"git://github.com/mothership-ec/cog-mothership-ecommerce.git","ssh_url":"git@github.com:mothership-ec/cog-mothership-ecommerce.git","clone_url":"https://github.com/mothership-ec/cog-mothership-ecommerce.git","svn_url":"https://github.com/mothership-ec/cog-mothership-ecommerce","homepage":null,"size":4080,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":55,"forks":1,"open_issues":55,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/pulls/249"},"html":{"href":"https://github.com/mothership-ec/cog-mothership-ecommerce/pull/249"},"issue":{"href":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/issues/249"},"comments":{"href":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/issues/249/comments"},"review_comments":{"href":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/pulls/249/comments"},"review_comment":{"href":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/pulls/249/commits"},"statuses":{"href":"https://api.github.com/repos/mothership-ec/cog-mothership-ecommerce/statuses/6e22fb77a00913396e0c890910903d4b289cf0c4"}}}}