Skip to content

Commit

Permalink
Merge pull request biig-io#52 from Nek-/feat/php8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek- authored Dec 7, 2021
2 parents c3bbf07 + fdd23f6 commit 5f1b396
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,11 @@ jobs:
name: Unit tests
strategy:
matrix:
php: [ 7.4, 8.0 ]
php: [ 8.0, 8.1 ]
os: [ ubuntu-latest ]
include:
- os: [ ubuntu-latest ]
php: 8.1
composer-flag: "'--ignore-platform-reqs'"

- os: [ ubuntu-latest ]
php: 7.3
php: 7.4
composer-flag: "'--prefer-lowest'"

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -76,15 +72,11 @@ jobs:
name: Functionnal tests
strategy:
matrix:
php: [ 7.4, 8.0 ]
php: [ 8.0, 8.1 ]
os: [ ubuntu-latest ]
include:
- os: [ ubuntu-latest ]
php: 8.1
composer-flag: "'--ignore-platform-reqs'"

- os: [ ubuntu-latest ]
php: 7.3
php: 7.4
composer-flag: "'--prefer-lowest'"

runs-on: ${{ matrix.os }}
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
"php": ">=7.3",
"nekland/tools": "^2.5.1",
"symfony/event-dispatcher": "^4.3 || ^5.0",
"pagerfanta/pagerfanta": "^2.0.1",
"pagerfanta/pagerfanta": "^2.0.1 || ^3.0.0",
"symfony/yaml": "^4.3 || ^5.0",
"symfony/serializer": "^4.3 || ^5.0"
"symfony/serializer": "^4.3 || ^5.0",
"pagerfanta/doctrine-orm-adapter": "^3.5"
},
"require-dev": {
"phpunit/phpunit": "^8.5",
Expand Down
8 changes: 7 additions & 1 deletion src/Doctrine/DoctrineDataStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use Pagerfanta\Adapter\DoctrineORMAdapter;
use Pagerfanta\Doctrine\ORM\QueryAdapter;
use Pagerfanta\Pagerfanta;
use SwagIndustries\Melodiia\Crud\FilterCollectionInterface;
use SwagIndustries\Melodiia\Crud\Persistence\DataStoreInterface;
Expand Down Expand Up @@ -44,7 +45,12 @@ public function getPaginated(string $type, int $page, FilterCollectionInterface
$qb = $doctrineRepository->createQueryBuilder('item');
$filters->filter($qb);

$pager = new Pagerfanta(new DoctrineORMAdapter($qb));
// Keep compatibility with pager fanta 2.X
if (class_exists(QueryAdapter::class)) {
$pager = new Pagerfanta(new QueryAdapter($qb));
} else {
$pager = new Pagerfanta(new DoctrineORMAdapter($qb));
}
$pager->setCurrentPage($page);
$pager->setMaxPerPage($maxPerPage);

Expand Down

0 comments on commit 5f1b396

Please sign in to comment.