BabDev / Pagerfanta

Pagination library for PHP applications with support for several data providers
Other
384 stars 170 forks source link

add TransformingAdapter #39

Closed IonBazan closed 2 years ago

IonBazan commented 2 years ago

This PR adds a new core adapter: TransformingAdapter, allowing users to transform data from the inner adapter passed in constructor.

This is very useful when presenting the data from database as DTOs in the Pagerfanta instance.

The transforming callback accepts both current item and key as parameters and return the transformed object. PHPStan annotations ensure type safety on all stages.

mbabker commented 2 years ago

Thanks!