Skip to content

Commit

Permalink
deps: support api-platform 4 (#38)
Browse files Browse the repository at this point in the history
* deps: support api-platform 4

* don't fail on deprecation for now

* silence deprecations
  • Loading branch information
priyadi authored Oct 30, 2024
1 parent 1ab3e29 commit 267419b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 0.8.0

* deps: support api-platform 4

## 0.7.7

* deps: bump rekapager
Expand Down
16 changes: 9 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,21 @@
],
"require": {
"php": ">=8.2",
"api-platform/core": "^3.2.12 || ^3.3",
"api-platform/core": "^3.2.12 || ^3.3 || ^4.0",
"doctrine/collections": "^2.2",
"rekalogika/mapper": "^1.1",
"rekalogika/rekapager-api-platform": "^0.18",
"rekalogika/rekapager-doctrine-collections-adapter": "^0.18",
"rekalogika/rekapager-doctrine-orm-adapter": "^0.18",
"rekalogika/mapper": "^1.13.3 || ^1.14",
"rekalogika/rekapager-api-platform": "^0.19",
"rekalogika/rekapager-doctrine-collections-adapter": "^0.19",
"rekalogika/rekapager-doctrine-orm-adapter": "^0.19",
"symfony/dependency-injection": "^6.4 || ^7.0",
"symfony/http-kernel": "^6.4 || ^7.0",
"symfony/security-core": "^6.4 || ^7.0",
"symfony/service-contracts": "^3.4"
},
"require-dev": {
"composer-runtime-api": "^2.2",
"bnf/phpstan-psr-container": "^1.0",
"composer/semver": "^3.4",
"doctrine/doctrine-bundle": "^2.12",
"doctrine/doctrine-fixtures-bundle": "^3.5",
"doctrine/orm": "^2.14 || ^3.0",
Expand All @@ -48,15 +50,15 @@
"rekalogika/doctrine-collections-decorator": "^2.2",
"symfony/asset": "^6.4 || ^7.0",
"symfony/browser-kit": "^6.4 || ^7.0",
"symfony/doctrine-bridge": "^6.4 || ^7.0",
"symfony/debug-bundle": "^6.4 || ^7.0",
"symfony/doctrine-bridge": "^6.4 || ^7.0",
"symfony/event-dispatcher": "^6.4 || ^7.0",
"symfony/expression-language": "^6.4 || ^7.0",
"symfony/framework-bundle": "^6.4 || ^7.0",
"symfony/http-client": "^6.4 || ^7.0",
"symfony/maker-bundle": "^1.55",
"symfony/property-access": "^6.4.4 || ^7.0.4 || ^7.1",
"symfony/property-info": "6.4.0 - 6.4.8 || 7.0.0 - 7.0.8 || 7.1.0 - 7.1.1 || ^7.2",
"symfony/maker-bundle": "^1.55",
"symfony/routing": "^6.4 || ^7.0",
"symfony/runtime": "^6.4 || ^7.0",
"symfony/security-bundle": "^6.4 || ^7.0",
Expand Down
5 changes: 3 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
failOnWarning="false"
failOnDeprecation="false"
cacheDirectory=".phpunit.cache"
beStrictAboutCoverageMetadata="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
Expand All @@ -16,7 +17,7 @@
<php>
<ini
name="display_errors"
value="1" />
value="0" />
<ini
name="error_reporting"
value="-1" />
Expand All @@ -41,4 +42,4 @@
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
</phpunit>
2 changes: 0 additions & 2 deletions tests/config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ api_platform:
rfc_7807_compliant_errors: true
normalization_context:
skip_null_values: false
event_listeners_backward_compatibility_layer: false
keep_legacy_inflector: false
mapping:
paths:
- '%kernel.project_dir%/tests/src/ApiResource'
Expand Down
17 changes: 17 additions & 0 deletions tests/src/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace App;

use ApiPlatform\Symfony\Bundle\ApiPlatformBundle;
use Composer\InstalledVersions;
use Composer\Semver\VersionParser;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle;
use Rekalogika\ApiLite\RekalogikaApiLiteBundle;
Expand Down Expand Up @@ -68,5 +70,20 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
$loader->load(function (ContainerBuilder $container) {
$container->loadFromExtension('rekalogika_api_lite', $this->config);
});

$loader->load(function (ContainerBuilder $container): void {
if (InstalledVersions::satisfies(new VersionParser(), 'api-platform/core', '3.*')) {
$container->loadFromExtension('api_platform', [
'event_listeners_backward_compatibility_layer' => false,
'keep_legacy_inflector' => false,
]);
} elseif (InstalledVersions::satisfies(new VersionParser(), 'api-platform/core', '4.*')) {
$container->loadFromExtension('api_platform', [
'serializer' => [
'hydra_prefix' => true,
],
]);
}
});
}
}

0 comments on commit 267419b

Please sign in to comment.