{"data":{"id":"magento2-36818","source":"github-pr","sourceRef":"magento/magento2#36818","title":"addFilterToMap function is not working for certain columns","pr":{"number":36818,"url":"https://github.com/magento/magento2/pull/36818","author":"ananth-iyer","mergedAt":"2024-06-16T12:10:28Z","mergeCommit":"f09c22200da0e9cb4481c953ebc0d1ce3a226f38","headCommit":"01199a42e3c374a05f5839231e3a1c1489cdd8cf","baseRef":"2.4-develop","diffSha256":"b07af0c4cd079ddcd570d756007e57098a9d347cdf1b8e45e8a9a5e66b5ca227"},"issues":[{"number":36719,"url":"https://github.com/magento/magento2/issues/36719","title":"addFilterToMap function is not working for certain columns","labels":["Area: Framework","Component: DB","Issue: Confirmed","Priority: P2","Progress: done","Reported on 2.4.5-p1","Reproduced on 2.4.x","Triage: Dev.Experience"],"kind":"human"}],"fixedIn":"2.4.8","containingTags":["2.4.8","2.4.8-p1","2.4.8-p2","2.4.8-p3","2.4.8-p4","2.4.8-p5","2.4.9"],"reportedOn":"2.4.5-p1","codeMatch":{"2.4.6":"clean","2.4.6-p1":"clean","2.4.6-p2":"clean","2.4.6-p3":"clean","2.4.6-p4":"clean","2.4.6-p5":"clean","2.4.6-p6":"clean","2.4.6-p7":"clean","2.4.6-p8":"clean","2.4.6-p9":"clean","2.4.6-p10":"clean","2.4.6-p11":"clean","2.4.6-p12":"clean","2.4.6-p13":"clean","2.4.6-p14":"clean","2.4.6-p15":"clean","2.4.7":"clean","2.4.7-p1":"clean","2.4.7-p2":"clean","2.4.7-p3":"clean","2.4.7-p4":"clean","2.4.7-p5":"clean","2.4.7-p6":"clean","2.4.7-p7":"clean","2.4.7-p8":"clean","2.4.7-p9":"clean","2.4.7-p10":"clean","2.4.8":"conflict","2.4.8-p1":"conflict","2.4.8-p2":"conflict","2.4.8-p3":"conflict","2.4.8-p4":"conflict","2.4.8-p5":"conflict","2.4.9":"file-missing"},"affectedVersions":["2.4.6","2.4.6-p1","2.4.6-p2","2.4.6-p3","2.4.6-p4","2.4.6-p5","2.4.6-p6","2.4.6-p7","2.4.6-p8","2.4.6-p9","2.4.6-p10","2.4.6-p11","2.4.6-p12","2.4.6-p13","2.4.6-p14","2.4.6-p15","2.4.7","2.4.7-p1","2.4.7-p2","2.4.7-p3","2.4.7-p4","2.4.7-p5","2.4.7-p6","2.4.7-p7","2.4.7-p8","2.4.7-p9","2.4.7-p10"],"components":["magento/module-sales"],"files":[{"path":"app/code/Magento/Sales/Plugin/Model/ResourceModel/Order/OrderGridCollectionFilter.php","change":"modified","package":"magento/module-sales"},{"path":"app/code/Magento/Sales/etc/adminhtml/di.xml","change":"modified","package":"magento/module-sales"}],"stripped":{"tests":["dev/tests/integration/testsuite/Magento/Sales/Plugin/Model/ResourceModel/Order/OrderGridCollectionFilterTest.php"],"docs":[],"outsideCode":[]},"linesChanged":13,"mergeBatched":false,"excluded":null,"sections":{"description":"applied filter mapping for `created_at` column not working. Getting error`SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'created_at' in where clause is ambiguous`.","stepsToReproduce":"1. Create custom grid in admin based on table that has  `created_at` column\n2. Rewrite `_initSelect` to add join with another table that also has `created_at` column and after that apply filter map `$this->addFilterToMap('created_at', 'main_table.created_at'); `\n3. Apply filter on the grid by 'created_at'  field or you can just apply `addFieldToFilter` by `created_at` column programmatically on you collection","expectedResult":"filtering of a collection by mapped  column `created_at` works without errors and uses applied filter mapping","actualResult":"applied filter mapping for `created_at` column not working. Getting error`SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'created_at' in where clause is ambiguous`.","source":"issue"},"signatures":[],"labels":{"area":["Framework"],"component":["DB"],"priority":"P2","severity":null,"reportedOn":["2.4.5-p1"]},"categories":[],"triage":{"model":"@cf/cloudflare/clef","requestHash":"7a36e1fc0cee97f37e2d0916aa7e8b8fc0c065e47bef6d4401e9d9f2e8c376ab","isBugfix":0.9782,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9495,"feature":0.0096,"refactor":0.0197,"tests_only":0.0103,"docs_only":0.0042,"dependency":0.0067},"confidence":0.8827},"scope":{"score":0.9828,"probabilities":{"0":0.2719,"1":0.4733,"2":0.2548},"confidence":0.0443},"risk":{"score":0.5739,"probabilities":{"0":0.5514,"1":0.3233,"2":0.1253},"confidence":0.1364},"area":{"choice":"admin","probabilities":{"catalog":0.0126,"checkout":0.0592,"customer":0.0063,"admin":0.6593,"graphql_api":0.0054,"framework":0.223,"frontend":0.0074,"other":0.0268},"confidence":0.4159},"securityRelevant":0.006,"reportedVersion":{"choice":"2.4.5-p1","probabilities":{"2.4.0":0.002,"2.4.0-p1":0.0024,"2.4.1":0.0021,"2.4.1-p1":0.0024,"2.4.2":0.0024,"2.4.2-p1":0.0028,"2.4.2-p2":0.0033,"2.4.3":0.0043,"2.4.3-p1":0.0042,"2.4.3-p2":0.0053,"2.4.3-p3":0.0031,"2.4.4":0.0028,"2.4.4-p1":0.0035,"2.4.4-p10":0.0039,"2.4.4-p11":0.004,"2.4.4-p12":0.0038,"2.4.4-p13":0.0034,"2.4.4-p14":0.0042,"2.4.4-p15":0.0035,"2.4.4-p16":0.0039,"2.4.4-p17":0.0038,"2.4.4-p18":0.0029,"2.4.4-p2":0.0022,"2.4.4-p3":0.0024,"2.4.4-p4":0.0026,"2.4.4-p5":0.003,"2.4.4-p6":0.0031,"2.4.4-p7":0.003,"2.4.4-p8":0.0032,"2.4.4-p9":0.003,"2.4.5":0.0454,"2.4.5-p1":0.5568,"2.4.5-p10":0.008,"2.4.5-p11":0.0097,"2.4.5-p12":0.0078,"2.4.5-p13":0.0086,"2.4.5-p14":0.0078,"2.4.5-p15":0.008,"2.4.5-p16":0.0072,"2.4.5-p17":0.0086,"2.4.5-p2":0.0132,"2.4.5-p3":0.0129,"2.4.5-p4":0.0119,"2.4.5-p5":0.0102,"2.4.5-p6":0.0083,"2.4.5-p7":0.0086,"2.4.5-p8":0.0082,"2.4.5-p9":0.0053,"2.4.6":0.0051,"2.4.6-p1":0.006,"2.4.6-p10":0.0054,"2.4.6-p11":0.0048,"2.4.6-p12":0.0055,"2.4.6-p13":0.0045,"2.4.6-p14":0.0048,"2.4.6-p15":0.0041,"2.4.6-p2":0.0034,"2.4.6-p3":0.0046,"2.4.6-p4":0.005,"2.4.6-p5":0.0044,"2.4.6-p6":0.0043,"2.4.6-p7":0.0044,"2.4.6-p8":0.0037,"2.4.6-p9":0.0029,"2.4.7":0.0031,"2.4.7-p1":0.0038,"2.4.7-p10":0.0036,"2.4.7-p2":0.0043,"2.4.7-p3":0.0049,"2.4.7-p4":0.0054,"2.4.7-p5":0.0055,"2.4.7-p6":0.0072,"2.4.7-p7":0.0049,"2.4.7-p8":0.0049,"2.4.7-p9":0.0027,"2.4.8":0.0034,"2.4.8-p1":0.0037,"2.4.8-p2":0.0046,"2.4.8-p3":0.0044,"2.4.8-p4":0.0055,"2.4.8-p5":0.0053,"2.4.9":0.0036,"unspecified":0.0033},"confidence":0.3062},"backportWorthy":{"score":1.553,"probabilities":{"0":0.0795,"1":0.288,"2":0.6325},"confidence":0.234}},"curated":{"title":"Fixes the ambiguous created_at column error when filtering custom admin grids","description":"On a custom grid collection joined with another table that also has created_at, a filter on created_at gives Column 'created_at' in where clause is ambiguous, as the Sales OrderGridCollectionFilter plugin on SearchResult ignores addFilterToMap. The Sales adminhtml di.xml now sets the plugin only on the Order, Invoice, Creditmemo and Shipment Grid Collection, and the plugin adds main_table.","categories":[],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.7-p10":{"before":"fail","after":"pass","adapted":false,"runAt":"2026-10-06T09:39:22.890Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"integration":{"before":"fail","after":"pass","runAt":"2026-10-06T09:39:22.890Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-36818 details"}