[PR #392] [MERGED] Invalid paginator query cloning #8121

Closed
opened 2026-01-22 15:58:29 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/392
Author: @egeloen
Created: 7/6/2012
Status: Merged
Merged: 7/8/2012
Merged by: @beberlei

Base: masterHead: patch-1


📝 Commits (3)

  • 996e47b Replaced a shallow-copy with a deep-copy to avoid side effects.
  • 8c24e52 Clone directly the ArrayCollection instead of looping
  • 3bdf869 Add clone query test

📊 Changes

2 files changed (+14 additions, -1 deletions)

View changed files

📝 lib/Doctrine/ORM/Tools/Pagination/Paginator.php (+3 -1)
📝 tests/Doctrine/Tests/ORM/Functional/PaginationTest.php (+11 -0)

📄 Description

Hey!

I'm currently using Symfony 2.1 + Doctrine master branch + Pager fanta master branch.

I'm facing a vicious issue.

The doctrine paginator is able to clone a query with his cloneQuery method. This method will only clone the query without this parameters & hints. The issue is the parameters is setted with the setParameters method which will only affect the ArrayCollection reference to the new query and so, shared the reference between the two queries.

This PR will clone the ArrayCollection instead of simply affect it.

Let me know if you need more information. :)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/392 **Author:** [@egeloen](https://github.com/egeloen) **Created:** 7/6/2012 **Status:** ✅ Merged **Merged:** 7/8/2012 **Merged by:** [@beberlei](https://github.com/beberlei) **Base:** `master` ← **Head:** `patch-1` --- ### 📝 Commits (3) - [`996e47b`](https://github.com/doctrine/orm/commit/996e47bf610c5b3ea22ea429b8c9a338db20fe0a) Replaced a shallow-copy with a deep-copy to avoid side effects. - [`8c24e52`](https://github.com/doctrine/orm/commit/8c24e528adffaf0987be270b2931b526dd08d577) Clone directly the ArrayCollection instead of looping - [`3bdf869`](https://github.com/doctrine/orm/commit/3bdf86922c62335199170974b6c275d11e7dda58) Add clone query test ### 📊 Changes **2 files changed** (+14 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/Tools/Pagination/Paginator.php` (+3 -1) 📝 `tests/Doctrine/Tests/ORM/Functional/PaginationTest.php` (+11 -0) </details> ### 📄 Description Hey! I'm currently using Symfony 2.1 + Doctrine master branch + Pager fanta master branch. I'm facing a vicious issue. The doctrine paginator is able to clone a query with his `cloneQuery` method. This method will only clone the query without this parameters & hints. The issue is the parameters is setted with the `setParameters` method which will only affect the ArrayCollection reference to the new query and so, shared the reference between the two queries. This PR will clone the ArrayCollection instead of simply affect it. Let me know if you need more information. :) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 15:58:29 +01:00
admin closed this issue 2026-01-22 15:58:30 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#8121