[EasyPagination] Improve enum support#1770
Conversation
alexndlm
commented
Feb 26, 2026
| Q | A |
|---|---|
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #... |
|
Code Review in Space: https://space.prod.v1.tools.eonx.com/p/support/reviews/148/timeline |
There was a problem hiding this comment.
Pull request overview
This PR fixes enum support in pagination by ensuring PHP BackedEnum instances used as query parameters are properly converted to their scalar values when working with Doctrine DBAL. The issue arises because Doctrine DBAL doesn't automatically handle enum conversion like Doctrine ORM does, causing errors when enums are passed as query parameters.
Changes:
- Added enum-to-scalar conversion logic in DBAL parameter handling
- Added enum conversion in ORM's large dataset pagination (which uses direct SQL execution bypassing ORM's type system)
- Added test coverage for enum parameter filtering in both ORM and DBAL paginators
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/EasyPagination/src/Paginator/DoctrineDbalPaginatorTrait.php | Added BackedEnum to scalar conversion when fetching DBAL query parameters |
| packages/EasyPagination/src/Paginator/DoctrineCommonPaginatorTrait.php | Added BackedEnum to scalar conversion for large dataset pagination that uses direct SQL execution |
| packages/EasyPagination/tests/Stub/Enum/Status.php | Added Status enum stub for testing enum parameter support |
| packages/EasyPagination/tests/Stub/Entity/Item.php | Added status field with enum type mapping to Item entity |
| packages/EasyPagination/tests/Unit/src/Paginator/AbstractDoctrineOrmPaginatorTestCase.php | Updated addItemToTable helper to support optional Status enum parameter |
| packages/EasyPagination/tests/Unit/src/Paginator/AbstractDoctrineDbalPaginatorTestCase.php | Updated addItemToTable helper and table schema to support Status enum |
| packages/EasyPagination/tests/Unit/src/Paginator/DoctrineOrmLengthAwarePaginatorTest.php | Added test case for filtering with enum parameters |
| packages/EasyPagination/tests/Unit/src/Paginator/DoctrineDbalLengthAwarePaginatorTest.php | Added test case for filtering with enum parameters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
akl-95
left a comment
There was a problem hiding this comment.
Good job! Code review complete.
Secure code in this PR has been written to best practice standards and covers the following as a minimum. Please ticket if coded this way (also tick if not relevant to this code change):
- Protect from Injection attacks
- Protect data with proper input validation, and protect against buffer overflows, pointers/shared data
- Protect with appropriate encryption and cryptography (E.g. Appropriate hashing, symmetric encryption used, ciphers) if applicable
- Protect against XSS and CSRF
- Ensure that pages, data access etc, are written with appropriate access control authorisation and authentication requirements
- Ensure all important errors and business logic cases are handled
- Ensure forwards and redirects are handled
- Ensure no sensitive data is exposed and appropriate logging in place as required
See procedure for more details: PROC-010 Secure Coding Practices
roman-eonx
left a comment
There was a problem hiding this comment.
Code review successful. 🚀 Well done!
Secure code in this PR has been written to best practice standards and covers the following as a minimum. Please ticket if coded this way (also tick if not relevant to this code change):
- Protect from Injection attacks
- Protect data with proper input validation, and protect against buffer overflows, pointers/shared data
- Protect with appropriate encryption and cryptography (E.g. Appropriate hashing, symmetric encryption used, ciphers) if applicable
- Protect against XSS and CSRF
- Ensure that pages, data access etc, are written with appropriate access control authorisation and authentication requirements
- Ensure all important errors and business logic cases are handled
- Ensure forwards and redirects are handled
- Ensure no sensitive data is exposed and appropriate logging in place as required
See procedure for more details: PROC-010 Secure Coding Practices