Skip to content

Commit

Permalink
Fix all deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
coldic3 committed Aug 23, 2024
1 parent c7e463c commit 0edee06
Show file tree
Hide file tree
Showing 24 changed files with 221 additions and 55 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/vendor/
/.php-cs-fixer.php
/.php-cs-fixer.cache
/.phpunit.cache
/phpunit.xml
/.phpunit.result.cache
/behat.yaml
Expand Down
1 change: 0 additions & 1 deletion .phpunit.cache/test-results

This file was deleted.

2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"lexik/jwt-authentication-bundle": "^2.18",
"nelmio/cors-bundle": "^2.2",
"phpstan/phpdoc-parser": "^1.16",
"stof/doctrine-extensions-bundle": "^1.12",
"symfony/asset": "^6.4",
"symfony/console": "^6.4",
"symfony/dotenv": "^6.4",
Expand All @@ -30,6 +31,7 @@
"symfony/runtime": "^6.4",
"symfony/security-bundle": "^6.4",
"symfony/serializer": "^6.4",
"symfony/string": "^6.4",
"symfony/twig-bundle": "^6.4",
"symfony/uid": "^6.4",
"symfony/validator": "^6.4",
Expand Down
96 changes: 88 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions src/Account/Infrastructure/ApiResource/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\Post;
use ApiPlatform\OpenApi\Model\Operation as OpenApiOperation;
use Panda\Account\Domain\Model\UserInterface;
use Panda\Account\Infrastructure\ApiState\Processor\UserCreateProcessor;
use Panda\Account\Infrastructure\ApiState\Provider\UserProvider;
Expand All @@ -20,13 +21,13 @@
operations: [
new Get(provider: UserProvider::class),
new Post(
openapiContext: [
'responses' => [
openapi: new OpenApiOperation(
responses: [
'204' => ['description' => 'User created or already exists'],
'400' => ['description' => 'Invalid input'],
'422' => ['description' => 'Unprocessable entity'],
],
],
),
validationContext: ['groups' => self::WRITABLE_GROUPS],
output: false,
processor: UserCreateProcessor::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(
) {
}

public function process($data, Operation $operation, array $uriVariables = [], array $context = [])
public function process($data, Operation $operation, array $uriVariables = [], array $context = []): UserResource
{
Assert::isInstanceOf($data, UserResource::class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ api_platform:
title: PANDA API
version: dev
show_webby: false
use_symfony_listeners: false
keep_legacy_inflector: false
patch_formats:
json: ['application/merge-patch+json']
formats:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ doctrine:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
enable_lazy_ghost_objects: true
controller_resolver:
auto_mapping: false
resolve_target_entities:
Panda\AccountOHS\Domain\Model\Owner\OwnerInterface: Panda\Account\Domain\Model\User
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true
http_method_override: false
handle_all_throwables: true
trusted_proxies: '%env(TRUSTED_PROXIES)%'
trusted_hosts: '%env(TRUSTED_HOSTS)%'
# See https://caddyserver.com/docs/caddyfile/directives/reverse_proxy#headers
Expand All @@ -12,6 +13,9 @@ framework:
#fragments: true
php_errors:
log: true

annotations:
enabled: false

when@test:
framework:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Read the documentation: https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html
# See the official DoctrineExtensions documentation for more details: https://github.com/doctrine-extensions/DoctrineExtensions/tree/main/doc
stof_doctrine_extensions:
default_locale: en_US
orm:
default:
timestampable: true
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
kernel:
resource: ../../../Symfony/Kernel.php
type: annotation
type: attribute
17 changes: 0 additions & 17 deletions src/Core/Infrastructure/Configuration/Symfony/Service/gedmo.php

This file was deleted.

1 change: 1 addition & 0 deletions src/Core/Infrastructure/Configuration/Symfony/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true],
Hautelook\AliceBundle\HautelookAliceBundle::class => ['dev' => true, 'test' => true],
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true],
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
];
2 changes: 1 addition & 1 deletion src/Core/Infrastructure/Configuration/Symfony/routes.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kernel:
resource: ../../../../Core/Infrastructure/Symfony/Kernel.php
type: annotation
type: attribute

app:
resource: ../../../../*/Infrastructure/Configuration/Symfony/Route/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

use Panda\Portfolio\Infrastructure\ApiResource\QuantityRepresentation;
use Panda\Portfolio\Infrastructure\ApiResource\ResourceRepresentation;
use Panda\Report\Infrastructure\ApiResource\ReportEntryRepresentation;
use Panda\Report\Infrastructure\ApiResource\ReportFileRepresentation;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
Expand Down Expand Up @@ -46,18 +44,17 @@ public function supportsNormalization(mixed $data, ?string $format = null, array
return
$data instanceof ResourceRepresentation
|| $data instanceof QuantityRepresentation
|| $data instanceof ReportEntryRepresentation
|| $data instanceof ReportFileRepresentation
;
}

// public function getSupportedTypes(?string $format): array
// {
// return [
// ResourceRepresentation::class => true,
// QuantityRepresentation::class => true,
// ReportEntryRepresentation::class => true,
// ReportFileRepresentation::class => true,
// ];
// }
/**
* @return array<class-string, bool>
*/
public function getSupportedTypes(?string $format): array
{
return [
ResourceRepresentation::class => false,
QuantityRepresentation::class => false,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(private CommandBusInterface $commandBus)
{
}

public function process($data, Operation $operation, array $uriVariables = [], array $context = [])
public function process($data, Operation $operation, array $uriVariables = [], array $context = []): PortfolioResource
{
/** @var PortfolioResource $data */
Assert::isInstanceOf($data, PortfolioResource::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct(private CommandBusInterface $commandBus)
{
}

public function process($data, Operation $operation, array $uriVariables = [], array $context = [])
public function process($data, Operation $operation, array $uriVariables = [], array $context = []): PortfolioResource
{
/** @var PortfolioResource $data */
Assert::isInstanceOf($data, PortfolioResource::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(private CommandBusInterface $commandBus)
{
}

public function process($data, Operation $operation, array $uriVariables = [], array $context = [])
public function process($data, Operation $operation, array $uriVariables = [], array $context = []): PortfolioResource
{
/** @var PortfolioResource $data */
Assert::isInstanceOf($data, PortfolioResource::class);
Expand Down
11 changes: 6 additions & 5 deletions src/Report/Infrastructure/ApiResource/ReportResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Post;
use ApiPlatform\OpenApi\Model\Operation as OpenApiOperation;
use Panda\Portfolio\Infrastructure\ApiResource\PortfolioResource;
use Panda\Report\Application\Action\DownloadReportAction;
use Panda\Report\Domain\Model\Report\ReportInterface;
Expand All @@ -26,10 +27,8 @@
uriTemplate: '/reports/{id}/download',
formats: ['csv' => ['text/csv']],
controller: DownloadReportAction::class,
openapiContext: [
'summary' => 'Downloads a report.',
'description' => 'Downloads a report.',
'responses' => [
openapi: new OpenApiOperation(
responses: [
'200' => [
'description' => 'Report file',
'content' => [
Expand All @@ -42,7 +41,9 @@
],
],
],
],
summary: 'Downloads a report.',
description: 'Downloads a report.',
),
),
new Post(
validationContext: ['groups' => ['create']],
Expand Down
Loading

0 comments on commit 0edee06

Please sign in to comment.