Skip to content

Conversation

@smarcet
Copy link
Collaborator

@smarcet smarcet commented Oct 13, 2025

ref https://app.clickup.com/t/86b6ycj3j
optimize performance

@smarcet smarcet requested a review from Copilot October 13, 2025 02:50
Copy link
Contributor

Copilot AI left a 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 getAllByPage method with a new implementation using getFastCount and getAllIdsByPage helper methods
  • Introduced a join catalog system with ensureJoin and requiredAliases methods 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.

Comment on lines +627 to +634
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");
}
}
Copy link

Copilot AI Oct 13, 2025

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.

Copilot uses AI. Check for mistakes.
$query = $this->applyExtraFilters($query);

if(!is_null($order)){
$order->apply2Query($query, $this->getOrderMappings($filter));
Copy link

Copilot AI Oct 13, 2025

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.

Copilot uses AI. Check for mistakes.
$query = $this->applyExtraFilters($query);

if(!is_null($order)){
$order->apply2Query($query, $this->getOrderMappings($filter));
Copy link

Copilot AI Oct 13, 2025

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.

Copilot uses AI. Check for mistakes.
$shouldPerformRandomOrderingByPage = true;
$order->removeOrder("page_random");
}
$order->apply2Query($query, $this->getOrderMappings());
Copy link

Copilot AI Oct 13, 2025

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.

Suggested change
$order->apply2Query($query, $this->getOrderMappings());
$order->apply2Query($query, $this->getOrderMappings($filter));

Copilot uses AI. Check for mistakes.
@smarcet smarcet force-pushed the hotfix/event-repo-get-all branch 9 times, most recently from 039e63c to 17005e9 Compare October 13, 2025 16:54
@smarcet smarcet force-pushed the hotfix/event-repo-get-all branch from 17005e9 to c15ce73 Compare October 13, 2025 17:08
Copy link
Contributor

@romanetar romanetar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@smarcet smarcet merged commit 553d4fd into main Oct 13, 2025
3 checks passed
smarcet added a commit that referenced this pull request Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants