{"action":"created","comment":{"url":"https://api.github.com/repos/cakephp/cakephp/pulls/comments/41100369","id":41100369,"diff_hunk":"@@ -0,0 +1,362 @@\n+<?php\n+/**\n+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)\n+ * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)\n+ *\n+ * Licensed under The MIT License\n+ * For full copyright and license information, please see the LICENSE.txt\n+ * Redistributions of files must retain the above copyright notice.\n+ *\n+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)\n+ * @link          http://cakephp.org CakePHP(tm) Project\n+ * @since         3.1\n+ * @license       http://www.opensource.org/licenses/mit-license.php MIT License\n+ */\n+\n+namespace Cake\\Datasource;\n+\n+/**\n+ * The basis for every query object\n+ *\n+ * @package Cake\\Datasource\n+ */\n+interface QueryInterface\n+{\n+\n+    /**\n+     * Returns a key => value array representing a single aliased field\n+     * that can be passed directly to the select() method.\n+     * The key will contain the alias and the value the actual field name.\n+     *\n+     * If the field is already aliased, then it will not be changed.\n+     * If no $alias is passed, the default table for this query will be used.\n+     *\n+     * @param string $field The field to alias\n+     * @param string $alias the alias used to prefix the field\n+     * @return array\n+     */\n+    public function aliasField($field, $alias = null);\n+\n+    /**\n+     * Fetch the results for this query.\n+     *\n+     * Will return either the results set through setResult(), or execute this query\n+     * and return the ResultSetDecorator object ready for streaming of results.\n+     *\n+     * ResultSetDecorator is a traversable object that implements the methods found\n+     * on Cake\\Collection\\Collection.\n+     *\n+     * @return \\Cake\\Datasource\\ResultSetInterface\n+     */\n+    public function all();\n+\n+    /**\n+     * Populates or adds parts to current query clauses using an array.\n+     * This is handy for passing all query clauses at once. The option array accepts:\n+     *\n+     * - fields: Maps to the select method\n+     * - conditions: Maps to the where method\n+     * - limit: Maps to the limit method\n+     * - order: Maps to the order method\n+     * - offset: Maps to the offset method\n+     * - group: Maps to the group method\n+     * - having: Maps to the having method\n+     * - contain: Maps to the contain options for eager loading\n+     * - join: Maps to the join method\n+     * - page: Maps to the page method\n+     *\n+     * ### Example:\n+     *\n+     * ```\n+     * $query->applyOptions([\n+     *   'fields' => ['id', 'name'],\n+     *   'conditions' => [\n+     *     'created >=' => '2013-01-01'\n+     *   ],\n+     *   'limit' => 10\n+     * ]);\n+     * ```\n+     *\n+     * Is equivalent to:\n+     *\n+     * ```\n+     *  $query\n+     *  ->select(['id', 'name'])\n+     *  ->where(['created >=' => '2013-01-01'])\n+     *  ->limit(10)\n+     * ```\n+     *\n+     * @param array $options list of query clauses to apply new parts to.\n+     * @return $this\n+     */\n+    public function applyOptions(array $options);\n+\n+    /**\n+     * Compiles the SQL representation of this query and executes it using the\n+     * configured connection object. Returns the resulting statement object.\n+     *\n+     * Executing a query internally executes several steps, the first one is\n+     * letting the connection transform this object to fit its particular dialect,\n+     * this might result in generating a different Query object that will be the one\n+     * to actually be executed. Immediately after, literal values are passed to the\n+     * connection so they are bound to the query in a safe way. Finally, the resulting\n+     * statement is decorated with custom objects to execute callbacks for each row\n+     * retrieved if necessary.\n+     *\n+     * Resulting statement is traversable, so it can be used in any loop as you would\n+     * with an array.\n+     *\n+     * This method can be overridden in query subclasses to decorate behavior\n+     * around query execution.\n+     *\n+     * @return \\Cake\\Database\\StatementInterface\n+     */\n+    public function execute();","path":"src/Datasource/QueryInterface.php","position":114,"original_position":114,"commit_id":"0026a8b4cd4084b3650ae9ae5646078b29f4d6aa","original_commit_id":"0026a8b4cd4084b3650ae9ae5646078b29f4d6aa","user":{"login":"markstory","id":24086,"avatar_url":"https://avatars.githubusercontent.com/u/24086?v=3","gravatar_id":"","url":"https://api.github.com/users/markstory","html_url":"https://github.com/markstory","followers_url":"https://api.github.com/users/markstory/followers","following_url":"https://api.github.com/users/markstory/following{/other_user}","gists_url":"https://api.github.com/users/markstory/gists{/gist_id}","starred_url":"https://api.github.com/users/markstory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markstory/subscriptions","organizations_url":"https://api.github.com/users/markstory/orgs","repos_url":"https://api.github.com/users/markstory/repos","events_url":"https://api.github.com/users/markstory/events{/privacy}","received_events_url":"https://api.github.com/users/markstory/received_events","type":"User","site_admin":false},"body":"Maybe that's an indication we shouldn't put it in the interface just yet.","created_at":"2015-10-04T18:06:44Z","updated_at":"2015-10-04T18:06:44Z","html_url":"https://github.com/cakephp/cakephp/pull/7491#discussion_r41100369","pull_request_url":"https://api.github.com/repos/cakephp/cakephp/pulls/7491","_links":{"self":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/comments/41100369"},"html":{"href":"https://github.com/cakephp/cakephp/pull/7491#discussion_r41100369"},"pull_request":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/7491"}}},"pull_request":{"url":"https://api.github.com/repos/cakephp/cakephp/pulls/7491","id":46468454,"html_url":"https://github.com/cakephp/cakephp/pull/7491","diff_url":"https://github.com/cakephp/cakephp/pull/7491.diff","patch_url":"https://github.com/cakephp/cakephp/pull/7491.patch","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/7491","number":7491,"state":"open","locked":false,"title":"[3.1] Implement a general QueryInterface","user":{"login":"Marlinc","id":1240253,"avatar_url":"https://avatars.githubusercontent.com/u/1240253?v=3","gravatar_id":"","url":"https://api.github.com/users/Marlinc","html_url":"https://github.com/Marlinc","followers_url":"https://api.github.com/users/Marlinc/followers","following_url":"https://api.github.com/users/Marlinc/following{/other_user}","gists_url":"https://api.github.com/users/Marlinc/gists{/gist_id}","starred_url":"https://api.github.com/users/Marlinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Marlinc/subscriptions","organizations_url":"https://api.github.com/users/Marlinc/orgs","repos_url":"https://api.github.com/users/Marlinc/repos","events_url":"https://api.github.com/users/Marlinc/events{/privacy}","received_events_url":"https://api.github.com/users/Marlinc/received_events","type":"User","site_admin":false},"body":"This change makes it possible to use the paginator on queries that aren't based on ```Cake\\ORM\\Query```.\r\n\r\nWe have used this for example using a bit of mini ORM quite we've written on top of ```UseMuffin/Webservice```. This change allows us to paginate the data from our custom query.\r\n\r\nI'm not sure about the performance impact of the ```class_uses``` and ```in_array``` but I'm open to suggestions!","created_at":"2015-09-30T23:07:18Z","updated_at":"2015-10-04T18:06:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"70baf9bbb697a5f3a16ed58b2a10011a9db6b7a7","assignee":null,"milestone":{"url":"https://api.github.com/repos/cakephp/cakephp/milestones/60","html_url":"https://github.com/cakephp/cakephp/milestones/3.1.1","labels_url":"https://api.github.com/repos/cakephp/cakephp/milestones/60/labels","id":1314897,"number":60,"title":"3.1.1","description":"Bugfixes and minor enhancements for 3.1.x","creator":{"login":"markstory","id":24086,"avatar_url":"https://avatars.githubusercontent.com/u/24086?v=3","gravatar_id":"","url":"https://api.github.com/users/markstory","html_url":"https://github.com/markstory","followers_url":"https://api.github.com/users/markstory/followers","following_url":"https://api.github.com/users/markstory/following{/other_user}","gists_url":"https://api.github.com/users/markstory/gists{/gist_id}","starred_url":"https://api.github.com/users/markstory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markstory/subscriptions","organizations_url":"https://api.github.com/users/markstory/orgs","repos_url":"https://api.github.com/users/markstory/repos","events_url":"https://api.github.com/users/markstory/events{/privacy}","received_events_url":"https://api.github.com/users/markstory/received_events","type":"User","site_admin":false},"open_issues":35,"closed_issues":56,"state":"open","created_at":"2015-09-20T02:24:50Z","updated_at":"2015-10-03T14:13:48Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/cakephp/cakephp/pulls/7491/commits","review_comments_url":"https://api.github.com/repos/cakephp/cakephp/pulls/7491/comments","review_comment_url":"https://api.github.com/repos/cakephp/cakephp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/7491/comments","statuses_url":"https://api.github.com/repos/cakephp/cakephp/statuses/0026a8b4cd4084b3650ae9ae5646078b29f4d6aa","head":{"label":"cvo-technologies:feature-pagination-query-trait","ref":"feature-pagination-query-trait","sha":"0026a8b4cd4084b3650ae9ae5646078b29f4d6aa","user":{"login":"cvo-technologies","id":1243867,"avatar_url":"https://avatars.githubusercontent.com/u/1243867?v=3","gravatar_id":"","url":"https://api.github.com/users/cvo-technologies","html_url":"https://github.com/cvo-technologies","followers_url":"https://api.github.com/users/cvo-technologies/followers","following_url":"https://api.github.com/users/cvo-technologies/following{/other_user}","gists_url":"https://api.github.com/users/cvo-technologies/gists{/gist_id}","starred_url":"https://api.github.com/users/cvo-technologies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvo-technologies/subscriptions","organizations_url":"https://api.github.com/users/cvo-technologies/orgs","repos_url":"https://api.github.com/users/cvo-technologies/repos","events_url":"https://api.github.com/users/cvo-technologies/events{/privacy}","received_events_url":"https://api.github.com/users/cvo-technologies/received_events","type":"Organization","site_admin":false},"repo":{"id":19697328,"name":"cakephp","full_name":"cvo-technologies/cakephp","owner":{"login":"cvo-technologies","id":1243867,"avatar_url":"https://avatars.githubusercontent.com/u/1243867?v=3","gravatar_id":"","url":"https://api.github.com/users/cvo-technologies","html_url":"https://github.com/cvo-technologies","followers_url":"https://api.github.com/users/cvo-technologies/followers","following_url":"https://api.github.com/users/cvo-technologies/following{/other_user}","gists_url":"https://api.github.com/users/cvo-technologies/gists{/gist_id}","starred_url":"https://api.github.com/users/cvo-technologies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvo-technologies/subscriptions","organizations_url":"https://api.github.com/users/cvo-technologies/orgs","repos_url":"https://api.github.com/users/cvo-technologies/repos","events_url":"https://api.github.com/users/cvo-technologies/events{/privacy}","received_events_url":"https://api.github.com/users/cvo-technologies/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cvo-technologies/cakephp","description":"CakePHP: The Rapid Development Framework for PHP - Official Repository","fork":true,"url":"https://api.github.com/repos/cvo-technologies/cakephp","forks_url":"https://api.github.com/repos/cvo-technologies/cakephp/forks","keys_url":"https://api.github.com/repos/cvo-technologies/cakephp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cvo-technologies/cakephp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cvo-technologies/cakephp/teams","hooks_url":"https://api.github.com/repos/cvo-technologies/cakephp/hooks","issue_events_url":"https://api.github.com/repos/cvo-technologies/cakephp/issues/events{/number}","events_url":"https://api.github.com/repos/cvo-technologies/cakephp/events","assignees_url":"https://api.github.com/repos/cvo-technologies/cakephp/assignees{/user}","branches_url":"https://api.github.com/repos/cvo-technologies/cakephp/branches{/branch}","tags_url":"https://api.github.com/repos/cvo-technologies/cakephp/tags","blobs_url":"https://api.github.com/repos/cvo-technologies/cakephp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cvo-technologies/cakephp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cvo-technologies/cakephp/git/refs{/sha}","trees_url":"https://api.github.com/repos/cvo-technologies/cakephp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cvo-technologies/cakephp/statuses/{sha}","languages_url":"https://api.github.com/repos/cvo-technologies/cakephp/languages","stargazers_url":"https://api.github.com/repos/cvo-technologies/cakephp/stargazers","contributors_url":"https://api.github.com/repos/cvo-technologies/cakephp/contributors","subscribers_url":"https://api.github.com/repos/cvo-technologies/cakephp/subscribers","subscription_url":"https://api.github.com/repos/cvo-technologies/cakephp/subscription","commits_url":"https://api.github.com/repos/cvo-technologies/cakephp/commits{/sha}","git_commits_url":"https://api.github.com/repos/cvo-technologies/cakephp/git/commits{/sha}","comments_url":"https://api.github.com/repos/cvo-technologies/cakephp/comments{/number}","issue_comment_url":"https://api.github.com/repos/cvo-technologies/cakephp/issues/comments{/number}","contents_url":"https://api.github.com/repos/cvo-technologies/cakephp/contents/{+path}","compare_url":"https://api.github.com/repos/cvo-technologies/cakephp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cvo-technologies/cakephp/merges","archive_url":"https://api.github.com/repos/cvo-technologies/cakephp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cvo-technologies/cakephp/downloads","issues_url":"https://api.github.com/repos/cvo-technologies/cakephp/issues{/number}","pulls_url":"https://api.github.com/repos/cvo-technologies/cakephp/pulls{/number}","milestones_url":"https://api.github.com/repos/cvo-technologies/cakephp/milestones{/number}","notifications_url":"https://api.github.com/repos/cvo-technologies/cakephp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cvo-technologies/cakephp/labels{/name}","releases_url":"https://api.github.com/repos/cvo-technologies/cakephp/releases{/id}","created_at":"2014-05-12T12:11:20Z","updated_at":"2014-07-26T19:41:00Z","pushed_at":"2015-10-03T22:29:12Z","git_url":"git://github.com/cvo-technologies/cakephp.git","ssh_url":"git@github.com:cvo-technologies/cakephp.git","clone_url":"https://github.com/cvo-technologies/cakephp.git","svn_url":"https://github.com/cvo-technologies/cakephp","homepage":"http://cakephp.org","size":86173,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cakephp:master","ref":"master","sha":"612ad4de35f5a91fd35fa3928f7e3ee05026f064","user":{"login":"cakephp","id":23666,"avatar_url":"https://avatars.githubusercontent.com/u/23666?v=3","gravatar_id":"","url":"https://api.github.com/users/cakephp","html_url":"https://github.com/cakephp","followers_url":"https://api.github.com/users/cakephp/followers","following_url":"https://api.github.com/users/cakephp/following{/other_user}","gists_url":"https://api.github.com/users/cakephp/gists{/gist_id}","starred_url":"https://api.github.com/users/cakephp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakephp/subscriptions","organizations_url":"https://api.github.com/users/cakephp/orgs","repos_url":"https://api.github.com/users/cakephp/repos","events_url":"https://api.github.com/users/cakephp/events{/privacy}","received_events_url":"https://api.github.com/users/cakephp/received_events","type":"Organization","site_admin":false},"repo":{"id":656494,"name":"cakephp","full_name":"cakephp/cakephp","owner":{"login":"cakephp","id":23666,"avatar_url":"https://avatars.githubusercontent.com/u/23666?v=3","gravatar_id":"","url":"https://api.github.com/users/cakephp","html_url":"https://github.com/cakephp","followers_url":"https://api.github.com/users/cakephp/followers","following_url":"https://api.github.com/users/cakephp/following{/other_user}","gists_url":"https://api.github.com/users/cakephp/gists{/gist_id}","starred_url":"https://api.github.com/users/cakephp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakephp/subscriptions","organizations_url":"https://api.github.com/users/cakephp/orgs","repos_url":"https://api.github.com/users/cakephp/repos","events_url":"https://api.github.com/users/cakephp/events{/privacy}","received_events_url":"https://api.github.com/users/cakephp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cakephp/cakephp","description":"CakePHP: The Rapid Development Framework for PHP - Official Repository","fork":false,"url":"https://api.github.com/repos/cakephp/cakephp","forks_url":"https://api.github.com/repos/cakephp/cakephp/forks","keys_url":"https://api.github.com/repos/cakephp/cakephp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cakephp/cakephp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cakephp/cakephp/teams","hooks_url":"https://api.github.com/repos/cakephp/cakephp/hooks","issue_events_url":"https://api.github.com/repos/cakephp/cakephp/issues/events{/number}","events_url":"https://api.github.com/repos/cakephp/cakephp/events","assignees_url":"https://api.github.com/repos/cakephp/cakephp/assignees{/user}","branches_url":"https://api.github.com/repos/cakephp/cakephp/branches{/branch}","tags_url":"https://api.github.com/repos/cakephp/cakephp/tags","blobs_url":"https://api.github.com/repos/cakephp/cakephp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cakephp/cakephp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cakephp/cakephp/git/refs{/sha}","trees_url":"https://api.github.com/repos/cakephp/cakephp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cakephp/cakephp/statuses/{sha}","languages_url":"https://api.github.com/repos/cakephp/cakephp/languages","stargazers_url":"https://api.github.com/repos/cakephp/cakephp/stargazers","contributors_url":"https://api.github.com/repos/cakephp/cakephp/contributors","subscribers_url":"https://api.github.com/repos/cakephp/cakephp/subscribers","subscription_url":"https://api.github.com/repos/cakephp/cakephp/subscription","commits_url":"https://api.github.com/repos/cakephp/cakephp/commits{/sha}","git_commits_url":"https://api.github.com/repos/cakephp/cakephp/git/commits{/sha}","comments_url":"https://api.github.com/repos/cakephp/cakephp/comments{/number}","issue_comment_url":"https://api.github.com/repos/cakephp/cakephp/issues/comments{/number}","contents_url":"https://api.github.com/repos/cakephp/cakephp/contents/{+path}","compare_url":"https://api.github.com/repos/cakephp/cakephp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cakephp/cakephp/merges","archive_url":"https://api.github.com/repos/cakephp/cakephp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cakephp/cakephp/downloads","issues_url":"https://api.github.com/repos/cakephp/cakephp/issues{/number}","pulls_url":"https://api.github.com/repos/cakephp/cakephp/pulls{/number}","milestones_url":"https://api.github.com/repos/cakephp/cakephp/milestones{/number}","notifications_url":"https://api.github.com/repos/cakephp/cakephp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cakephp/cakephp/labels{/name}","releases_url":"https://api.github.com/repos/cakephp/cakephp/releases{/id}","created_at":"2010-05-08T14:38:22Z","updated_at":"2015-10-04T16:34:39Z","pushed_at":"2015-10-04T14:15:27Z","git_url":"git://github.com/cakephp/cakephp.git","ssh_url":"git@github.com:cakephp/cakephp.git","clone_url":"https://github.com/cakephp/cakephp.git","svn_url":"https://github.com/cakephp/cakephp","homepage":"http://cakephp.org","size":185682,"stargazers_count":6086,"watchers_count":6086,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2759,"mirror_url":null,"open_issues_count":146,"forks":2759,"open_issues":146,"watchers":6086,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/7491"},"html":{"href":"https://github.com/cakephp/cakephp/pull/7491"},"issue":{"href":"https://api.github.com/repos/cakephp/cakephp/issues/7491"},"comments":{"href":"https://api.github.com/repos/cakephp/cakephp/issues/7491/comments"},"review_comments":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/7491/comments"},"review_comment":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/7491/commits"},"statuses":{"href":"https://api.github.com/repos/cakephp/cakephp/statuses/0026a8b4cd4084b3650ae9ae5646078b29f4d6aa"}}}}