-
Notifications
You must be signed in to change notification settings - Fork 2
chore: refactor DoctrineSummitEventRepository::getAllByPage #396
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
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 refactors the getAllByPage method in DoctrineSummitEventRepository to optimize performance by implementing a two-phase query approach: first fetching IDs with filters/ordering, then retrieving full entities by ID.
- Replaced the original
getAllByPagemethod with a new implementation usinggetFastCountandgetAllIdsByPagehelper methods - Introduced a join catalog system with
ensureJoinandrequiredAliasesmethods for dynamic join management - Reorganized filter and order mappings for better maintainability
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if (!is_null($filter)) { | ||
| $filter->apply2Query($query, $this->getFilterMappings($filter)); | ||
|
|
||
| if($filter->hasFilter('actions')) { | ||
| // if actions filter is required, we should do an inner join with the allowed | ||
| // actions of the selection plan of the presentation | ||
| $query = $query->andWhere("allowed_at_type = at"); | ||
| } | ||
| } |
Copilot
AI
Oct 13, 2025
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.
Duplicated filter application logic - the filter is applied twice on lines 624 and 628. This could cause incorrect query results or performance issues.
| $query = $this->applyExtraFilters($query); | ||
|
|
||
| if(!is_null($order)){ | ||
| $order->apply2Query($query, $this->getOrderMappings($filter)); |
Copilot
AI
Oct 13, 2025
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.
Inconsistent parameter usage for getOrderMappings() - sometimes called with $filter parameter and sometimes without. This should be standardized across all usages.
| $query = $this->applyExtraFilters($query); | ||
|
|
||
| if(!is_null($order)){ | ||
| $order->apply2Query($query, $this->getOrderMappings($filter)); |
Copilot
AI
Oct 13, 2025
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.
Inconsistent parameter usage for getOrderMappings() - sometimes called with $filter parameter and sometimes without. This should be standardized across all usages.
| $shouldPerformRandomOrderingByPage = true; | ||
| $order->removeOrder("page_random"); | ||
| } | ||
| $order->apply2Query($query, $this->getOrderMappings()); |
Copilot
AI
Oct 13, 2025
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.
Inconsistent parameter usage for getOrderMappings() - sometimes called with $filter parameter and sometimes without. This should be standardized across all usages.
| $order->apply2Query($query, $this->getOrderMappings()); | |
| $order->apply2Query($query, $this->getOrderMappings($filter)); |
039e63c to
17005e9
Compare
optimice performance
17005e9 to
c15ce73
Compare
romanetar
left a comment
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.
LGTM
ref https://app.clickup.com/t/86b6ycj3j
optimize performance