Skip to content

[EasyPagination] Improve enum support#1770

Merged
roman-eonx merged 2 commits into
masterfrom
feature/easy-pagination-improve-enum-support
Feb 26, 2026
Merged

[EasyPagination] Improve enum support#1770
roman-eonx merged 2 commits into
masterfrom
feature/easy-pagination-improve-enum-support

Conversation

@alexndlm
Copy link
Copy Markdown
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #...

@alexndlm alexndlm requested a review from Copilot February 26, 2026 10:25
@eonx-space-to-github-reviews
Copy link
Copy Markdown

@alexndlm alexndlm changed the title feature/easy-pagination-improve-enum-support [EasyPagination Improve enum support Feb 26, 2026
@alexndlm alexndlm changed the title [EasyPagination Improve enum support [EasyPagination] Improve enum support Feb 26, 2026
Copy link
Copy Markdown

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 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.

Copy link
Copy Markdown
Contributor

@akl-95 akl-95 left a comment

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

@roman-eonx roman-eonx left a comment

Choose a reason for hiding this comment

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

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

@roman-eonx roman-eonx merged commit 20e6e0a into master Feb 26, 2026
89 checks passed
@roman-eonx roman-eonx deleted the feature/easy-pagination-improve-enum-support branch February 26, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants