-
-
Notifications
You must be signed in to change notification settings - Fork 450
Remove unnecessary GROUP BY clause #5216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Remove unnecessary GROUP BY clause #5216
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR removes an unnecessary GROUP BY clause from the SQL query in getProductCount() method and modernizes the method signature with type hints.
- Removes redundant
GROUP BYclause from a SQL query that already filters by a single category ID - Adds parameter type hint and return type declaration to improve type safety
- Minor docblock formatting improvement
|
There are a few PHP CS Fixer errors. |
Removed unnecessary docblock comments from getProductCount method.
|
|
All green this is good. I’ve reviewed the change together with the current implementation of From an SQL point of view, removing the The PR also tightens the method signature: public function getProductCount(Mage_Catalog_Model_Category $category): intSemantically, this matches how the method is intended to be used: it operates on a From a pure bugfix perspective, I’d suggest one of the following:
In summary, the removal of the GROUP BY is correct and improves the query; the method type hints are technically correct but may warrant a separate discussion due to potential BC implications. @colinmollenhour - please take a look to this PR. |
|
I'm going to get chewed out for this but, sometimes it's worth it: This is far too pedantic for my taste. I'm definitely not a position to fight all the tooling employed to defend against misplaced whitespace and curly brackets and the likes. I have diagnosed, fixed, tested, deployed and did a project-wide search for the same issue faster than I get past these 'quality'* tools. I'm sure you all mean well, but I do not use any of that stuff and so it mostly serves to hold me back. * "Quality" meaning: The warm feeling of knowing that the characters are lined up, cased and spaced just right, such that it gives a false sense of confidence in their actual usefulness. Like a wonderfully orchestrated military parade of a country that cannot defend its own submarines in its own harbor. Or astrology. So confirmed by multiple complex QA tools that, and I'm not going to check this, themselves are an absolute mess internally because all great utilities are a mess internally. Please, whoever reads this, take this tiny little PR and make it your own, you have my blessing! Rant I: Rant II: Happy new year, I (L) you all. |
|
@loekvangool - I understand the frustration with tooling and strict “quality” rules, especially when you’ve already diagnosed, fixed, tested, and even searched the codebase for similar issues faster than it takes to satisfy all the checks. It’s clear your intention is to help the project, not to get stuck in bureaucracy. On the other hand, for a larger open‑source project, a certain level of standardization (formatting, QA tools, coding rules) does have benefits in the long run:
That doesn’t mean the current setup is perfect or free of overhead — your points about the gap between “ideal rules” and the actual state of the code are valid. Realistically, we probably need a balance between pragmatism (quickly fixing real bugs like this one) and technical discipline (tooling, broader refactors where it’s feasible and safe). I don't like it when I see tests failing either, but if Copilot is in charge of PR, I ask the AI to fix them for me. My only concern is BC, which is why I'm waiting for more informed opinions. Happy New Year, and thanks again for the PR and for sharing your thoughts. |
|
Thanks for PR and input.
With php-cs-fixer and rector we have tools to modernize/unifom/standardize code. Why not use them? The linedup characters ... i have edited thousands of docblocks, carying about spacing and order. Now its fixed automatically. For rant I ... instead of creating a well described issue, you could have create a PR directly. Id not have reviewed within 40min as Jan 1 is my birthday, but it would been merged in time - without added type hints (that should be discussed for coming releases) For rant II ...
Dont blame the tools :P You have added type hints and that makes parameter docs obsolete. (pls revert) |



Fixes #5206
Contribution checklist (*)