Skip to content

Commit

Permalink
deps: DBAL 4.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Sep 1, 2024
1 parent 2277eb3 commit ae9501a
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 38 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* test: update fixtures to include enum in sort field
* chore: various demo polishing
* chore: rector clean up
* deps: DBAL 4.0 compatibility

# 0.16.1

Expand Down
62 changes: 31 additions & 31 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,20 @@
{
"name": "rekalogika/rekapager",
"homepage": "https://rekalogika.dev/rekapager",
"description": "Pagination library for PHP, supporting both offset-based and keyset-based pagination.",
"license": "MIT",
"type": "library",
"description": "Pagination library for PHP, supporting both offset-based and keyset-based pagination.",
"authors": [
{
"name": "Priyadi Iman Nurcahyo",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Rekalogika\\Contracts\\Rekapager\\": "packages/rekapager-contracts/src/",
"Rekalogika\\Rekapager\\": "packages/rekapager-core/src/",
"Rekalogika\\Rekapager\\Adapter\\Common\\": "packages/rekapager-adapter-common/src/",
"Rekalogika\\Rekapager\\ApiPlatform\\": "packages/rekapager-api-platform/src/",
"Rekalogika\\Rekapager\\Bundle\\": "packages/rekapager-bundle/src/",
"Rekalogika\\Rekapager\\Doctrine\\Collections\\": "packages/rekapager-doctrine-collections-adapter/src/",
"Rekalogika\\Rekapager\\Doctrine\\DBAL\\": "packages/rekapager-doctrine-dbal-adapter/src/",
"Rekalogika\\Rekapager\\Doctrine\\ORM\\": "packages/rekapager-doctrine-orm-adapter/src/",
"Rekalogika\\Rekapager\\Keyset\\": "packages/rekapager-keyset-pagination/src/",
"Rekalogika\\Rekapager\\Offset\\": "packages/rekapager-offset-pagination/src/",
"Rekalogika\\Rekapager\\Pagerfanta\\": "packages/rekapager-pagerfanta-adapter/src/",
"Rekalogika\\Rekapager\\Symfony\\": "packages/rekapager-symfony-bridge/src/"
}
},
"autoload-dev": {
"psr-4": {
"Rekalogika\\Rekapager\\Tests\\": "tests/src/"
}
},
"homepage": "https://rekalogika.dev/rekapager",
"require": {
"php": "^8.2",
"api-platform/core": "^3.2",
"doctrine/collections": "^2.2",
"doctrine/dbal": "^3.8",
"doctrine/dbal": "^3.8 || ^4.0",
"doctrine/orm": "^2.19 || ^3.0",
"pagerfanta/core": "^4.0",
"pagerfanta/doctrine-collections-adapter": "^4.0",
Expand Down Expand Up @@ -90,13 +69,6 @@
"vimeo/psalm": "^5.15",
"zenstruck/foundry": "1.37.*"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"symfony/runtime": true,
"symfony/flex": false
}
},
"replace": {
"rekalogika/rekapager-adapter-common": "0.16.1",
"rekalogika/rekapager-api-platform": "0.16.1",
Expand All @@ -110,5 +82,33 @@
"rekalogika/rekapager-offset-pagination": "0.16.1",
"rekalogika/rekapager-pagerfanta-adapter": "0.16.1",
"rekalogika/rekapager-symfony-bridge": "0.16.1"
},
"autoload": {
"psr-4": {
"Rekalogika\\Contracts\\Rekapager\\": "packages/rekapager-contracts/src/",
"Rekalogika\\Rekapager\\": "packages/rekapager-core/src/",
"Rekalogika\\Rekapager\\Adapter\\Common\\": "packages/rekapager-adapter-common/src/",
"Rekalogika\\Rekapager\\ApiPlatform\\": "packages/rekapager-api-platform/src/",
"Rekalogika\\Rekapager\\Bundle\\": "packages/rekapager-bundle/src/",
"Rekalogika\\Rekapager\\Doctrine\\Collections\\": "packages/rekapager-doctrine-collections-adapter/src/",
"Rekalogika\\Rekapager\\Doctrine\\DBAL\\": "packages/rekapager-doctrine-dbal-adapter/src/",
"Rekalogika\\Rekapager\\Doctrine\\ORM\\": "packages/rekapager-doctrine-orm-adapter/src/",
"Rekalogika\\Rekapager\\Keyset\\": "packages/rekapager-keyset-pagination/src/",
"Rekalogika\\Rekapager\\Offset\\": "packages/rekapager-offset-pagination/src/",
"Rekalogika\\Rekapager\\Pagerfanta\\": "packages/rekapager-pagerfanta-adapter/src/",
"Rekalogika\\Rekapager\\Symfony\\": "packages/rekapager-symfony-bridge/src/"
}
},
"autoload-dev": {
"psr-4": {
"Rekalogika\\Rekapager\\Tests\\": "tests/src/"
}
},
"config": {
"sort-packages": true,
"allow-plugins": {
"symfony/runtime": true,
"symfony/flex": false
}
}
}
2 changes: 1 addition & 1 deletion packages/rekapager-doctrine-dbal-adapter/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"require": {
"php": "^8.2",
"doctrine/dbal": "^3.8",
"doctrine/dbal": "^3.8 || ^4.0",
"doctrine/collections": "^2.2",
"rekalogika/rekapager-adapter-common": "^0.16.1",
"rekalogika/rekapager-keyset-pagination": "^0.16.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Rekalogika\Rekapager\Doctrine\DBAL\Internal;

use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Types\Type;

/**
Expand All @@ -22,7 +24,7 @@
{
public function __construct(
private mixed $value,
private int|string|Type|null $type = null
private string|ParameterType|Type|ArrayParameterType $type = ParameterType::STRING
) {
}

Expand All @@ -31,7 +33,7 @@ public function getValue(): mixed
return $this->value;
}

public function getType(): int|string|Type|null
public function getType(): string|ParameterType|Type|ArrayParameterType
{
return $this->type;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private function getQueryBuilder(

/** @var mixed $value */
foreach ($boundaryValues ?? [] as $property => $value) {
$newBoundaryValues[$property] = new QueryParameter($value, null);
$newBoundaryValues[$property] = new QueryParameter($value);
}

$boundaryValues = $newBoundaryValues;
Expand Down Expand Up @@ -408,7 +408,7 @@ private function doCount(
* @psalm-suppress RedundantCondition
* @phpstan-ignore-next-line
*/
if (\is_callable($queryBuilder->resetQueryPart(...))) {
if (\is_callable([$queryBuilder, 'resetQueryPart'])) {
return $this->doCountWithSubquery($queryBuilder);
}

Expand Down Expand Up @@ -442,12 +442,15 @@ private function doCountWithSubquery(QueryBuilder $queryBuilder): int
$queryBuilder = (clone $queryBuilder);
$sql = $queryBuilder->getSQL();

if (\is_callable([$queryBuilder, 'resetQueryPart'])) {
$queryBuilder->resetQueryPart('from');
}

/**
* @psalm-suppress DeprecatedMethod
* @phpstan-ignore-next-line
*/
$queryBuilder
->resetQueryPart('from')
->resetGroupBy()
->resetHaving()
->resetOrderBy()
Expand Down
2 changes: 1 addition & 1 deletion packages/rekapager-doctrine-orm-adapter/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"require": {
"php": "^8.2",
"doctrine/dbal": "^3.8",
"doctrine/dbal": "^3.8 || ^4.0",
"doctrine/orm": "^2.19 || ^3.0",
"doctrine/collections": "^2.2",
"rekalogika/rekapager-adapter-common": "^0.16.1",
Expand Down

0 comments on commit ae9501a

Please sign in to comment.