{"action":"created","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/8425","repository_url":"https://api.github.com/repos/cakephp/cakephp","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/8425/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/8425/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/8425/events","html_url":"https://github.com/cakephp/cakephp/issues/8425","id":139310356,"number":8425,"title":"Prepared statements combined with subqueries results in wrong params","user":{"login":"boindil","id":4290644,"avatar_url":"https://avatars.githubusercontent.com/u/4290644?v=3","gravatar_id":"","url":"https://api.github.com/users/boindil","html_url":"https://github.com/boindil","followers_url":"https://api.github.com/users/boindil/followers","following_url":"https://api.github.com/users/boindil/following{/other_user}","gists_url":"https://api.github.com/users/boindil/gists{/gist_id}","starred_url":"https://api.github.com/users/boindil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boindil/subscriptions","organizations_url":"https://api.github.com/users/boindil/orgs","repos_url":"https://api.github.com/users/boindil/repos","events_url":"https://api.github.com/users/boindil/events{/privacy}","received_events_url":"https://api.github.com/users/boindil/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cakephp/cakephp/labels/On%20hold","name":"On hold","color":"eb6420"},{"url":"https://api.github.com/repos/cakephp/cakephp/labels/ORM","name":"ORM","color":"ffffff"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/cakephp/cakephp/milestones/82","html_url":"https://github.com/cakephp/cakephp/milestones/3.2.5","labels_url":"https://api.github.com/repos/cakephp/cakephp/milestones/82/labels","id":1625052,"number":82,"title":"3.2.5","description":"Bugfixes and minor optimizations for 3.2.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":33,"closed_issues":9,"state":"open","created_at":"2016-03-07T01:54:50Z","updated_at":"2016-03-09T16:09:17Z","due_on":"2016-03-20T04:00:00Z","closed_at":null},"comments":6,"created_at":"2016-03-08T15:46:31Z","updated_at":"2016-03-09T21:46:52Z","closed_at":null,"body":"This is a (multiple allowed):\r\n* [x] bug\r\n* [ ] enhancement\r\n* [ ] feature-discussion (RFC)\r\n\r\n* CakePHP Version: 3.2.4\r\n* Platform and Target: apache 2.4 / nginx / mariadb 5.5\r\n\r\n### What you did\r\nI have 2 nice subqueries build with standard `$table->find()` and a main query built with `$table->find()`.\r\n\r\nI have multiple conditions in subqueries 1 and 2 (each one has two arguments). I have three conditions in my main query.\r\n\r\nThe subqueries are used in `$maintable->select()`.\r\n\r\n### Expected Behavior\r\nQuery created like this:\r\n```\r\nSELECT ... subquery1 (with :c0, :c1) ... subquery2 (with :c2, :c3) ... WHERE _mainconditions_ (with :c4, :c5, :c6)\r\n```\r\n\r\n### Actual Behavior\r\nQuery created like this:\r\n```\r\nSELECT ... subquery1 (with :c0, :c1) ... subquery2 (with :c0, :c1) ... WHERE _mainconditions_ (with :c0, :c1, :c2)\r\n```\r\nc0, c1 and c2 are filled with the main conditions, while the subquery conditions are ignored"},"comment":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/194523403","html_url":"https://github.com/cakephp/cakephp/issues/8425#issuecomment-194523403","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/8425","id":194523403,"user":{"login":"boindil","id":4290644,"avatar_url":"https://avatars.githubusercontent.com/u/4290644?v=3","gravatar_id":"","url":"https://api.github.com/users/boindil","html_url":"https://github.com/boindil","followers_url":"https://api.github.com/users/boindil/followers","following_url":"https://api.github.com/users/boindil/following{/other_user}","gists_url":"https://api.github.com/users/boindil/gists{/gist_id}","starred_url":"https://api.github.com/users/boindil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boindil/subscriptions","organizations_url":"https://api.github.com/users/boindil/orgs","repos_url":"https://api.github.com/users/boindil/repos","events_url":"https://api.github.com/users/boindil/events{/privacy}","received_events_url":"https://api.github.com/users/boindil/received_events","type":"User","site_admin":false},"created_at":"2016-03-09T21:46:52Z","updated_at":"2016-03-09T21:46:52Z","body":"> You can use `->from('aliasname' => 'tablename')` explicitly in your sub-query building to circumvent alias collisions.\r\n\r\nYou're right on that, but I'm not sure how this helps on the params. This would fit more on #8427 I think - or am I missing something right now? "}}