diff --git a/composer.lock b/composer.lock index 6c20dd0..12839ec 100644 --- a/composer.lock +++ b/composer.lock @@ -10016,16 +10016,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.89.0", + "version": "v3.92.5", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "4dd6768cb7558440d27d18f54909eee417317ce9" + "reference": "260cc8c4a1d2f6d2f22cd4f9c70aa72e55ebac58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/4dd6768cb7558440d27d18f54909eee417317ce9", - "reference": "4dd6768cb7558440d27d18f54909eee417317ce9", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/260cc8c4a1d2f6d2f22cd4f9c70aa72e55ebac58", + "reference": "260cc8c4a1d2f6d2f22cd4f9c70aa72e55ebac58", "shasum": "" }, "require": { @@ -10043,30 +10043,31 @@ "react/socket": "^1.16", "react/stream": "^1.4", "sebastian/diff": "^4.0.6 || ^5.1.1 || ^6.0.2 || ^7.0", - "symfony/console": "^5.4.47 || ^6.4.24 || ^7.0", - "symfony/event-dispatcher": "^5.4.45 || ^6.4.24 || ^7.0", - "symfony/filesystem": "^5.4.45 || ^6.4.24 || ^7.0", - "symfony/finder": "^5.4.45 || ^6.4.24 || ^7.0", - "symfony/options-resolver": "^5.4.45 || ^6.4.24 || ^7.0", + "symfony/console": "^5.4.47 || ^6.4.24 || ^7.0 || ^8.0", + "symfony/event-dispatcher": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0", + "symfony/filesystem": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0", + "symfony/finder": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0", + "symfony/options-resolver": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0", "symfony/polyfill-mbstring": "^1.33", "symfony/polyfill-php80": "^1.33", "symfony/polyfill-php81": "^1.33", "symfony/polyfill-php84": "^1.33", - "symfony/process": "^5.4.47 || ^6.4.24 || ^7.2", - "symfony/stopwatch": "^5.4.45 || ^6.4.24 || ^7.0" + "symfony/process": "^5.4.47 || ^6.4.24 || ^7.2 || ^8.0", + "symfony/stopwatch": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0" }, "require-dev": { "facile-it/paraunit": "^1.3.1 || ^2.7", - "infection/infection": "^0.31.0", - "justinrainbow/json-schema": "^6.5", - "keradus/cli-executor": "^2.2", + "infection/infection": "^0.31", + "justinrainbow/json-schema": "^6.6", + "keradus/cli-executor": "^2.3", "mikey179/vfsstream": "^1.6.12", - "php-coveralls/php-coveralls": "^2.8", + "php-coveralls/php-coveralls": "^2.9", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6", - "phpunit/phpunit": "^9.6.25 || ^10.5.53 || ^11.5.34", - "symfony/var-dumper": "^5.4.48 || ^6.4.24 || ^7.3.2", - "symfony/yaml": "^5.4.45 || ^6.4.24 || ^7.3.2" + "phpunit/phpunit": "^9.6.31 || ^10.5.60 || ^11.5.46", + "symfony/polyfill-php85": "^1.33", + "symfony/var-dumper": "^5.4.48 || ^6.4.26 || ^7.4.0 || ^8.0", + "symfony/yaml": "^5.4.45 || ^6.4.30 || ^7.4.1 || ^8.0" }, "suggest": { "ext-dom": "For handling output formats in XML", @@ -10081,7 +10082,7 @@ "PhpCsFixer\\": "src/" }, "exclude-from-classmap": [ - "src/Fixer/Internal/*" + "src/**/Internal/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -10107,7 +10108,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.89.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.92.5" }, "funding": [ { @@ -10115,7 +10116,7 @@ "type": "github" } ], - "time": "2025-10-18T19:30:16+00:00" + "time": "2026-01-08T21:57:37+00:00" }, { "name": "masterminds/html5", diff --git a/migrations/Version20260116120442.php b/migrations/Version20260116120442.php new file mode 100644 index 0000000..f47024b --- /dev/null +++ b/migrations/Version20260116120442.php @@ -0,0 +1,28 @@ +addSql('CREATE INDEX IDX_AF382D4E3D4E91C8BF396750 ON checkout (gateway_name, id)'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP INDEX IDX_AF382D4E3D4E91C8BF396750 ON checkout'); + } +} diff --git a/src/ApiResource/Gateway/ChargeApiResource.php b/src/ApiResource/Gateway/ChargeApiResource.php index 58e62e6..efcd4b9 100644 --- a/src/ApiResource/Gateway/ChargeApiResource.php +++ b/src/ApiResource/Gateway/ChargeApiResource.php @@ -92,9 +92,11 @@ class ChargeApiResource #[API\ApiProperty(writable: false)] #[API\ApiFilter(Filter\DateFilter::class)] + #[API\ApiFilter(Filter\OrderFilter::class, properties: ['dateCreated' => 'DESC'])] public \DateTimeInterface $dateCreated; #[API\ApiProperty(writable: false)] #[API\ApiFilter(Filter\DateFilter::class)] + #[API\ApiFilter(Filter\OrderFilter::class, properties: ['dateUpdated' => 'DESC'])] public \DateTimeInterface $dateUpdated; } diff --git a/src/Entity/Gateway/Checkout.php b/src/Entity/Gateway/Checkout.php index 41f90e1..78eec2c 100644 --- a/src/Entity/Gateway/Checkout.php +++ b/src/Entity/Gateway/Checkout.php @@ -29,6 +29,7 @@ use Symfony\Component\Validator\Constraints as Assert; #[MapProvider(EntityMapProvider::class)] #[Gedmo\Loggable()] #[ORM\Index(fields: ['migratedId'])] +#[ORM\Index(fields: ['gatewayName', 'id'])] #[ORM\Entity(repositoryClass: CheckoutRepository::class)] class Checkout { diff --git a/src/Filter/GatewayFilter.php b/src/Filter/GatewayFilter.php index da95f95..2e4fbce 100644 --- a/src/Filter/GatewayFilter.php +++ b/src/Filter/GatewayFilter.php @@ -4,20 +4,21 @@ namespace App\Filter; use ApiPlatform\Doctrine\Orm\Filter\AbstractFilter; use ApiPlatform\Doctrine\Orm\Util\QueryNameGeneratorInterface; -use ApiPlatform\Metadata\IriConverterInterface; use ApiPlatform\Metadata\Operation; -use App\ApiResource\Gateway\GatewayApiResource; +use App\Gateway\Exception\MissingGatewayException; +use App\Gateway\GatewayLocator; use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Psr\Log\LoggerInterface; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\PropertyInfo\Type; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; final class GatewayFilter extends AbstractFilter { public function __construct( - private IriConverterInterface $iriConverter, + private GatewayLocator $gatewayLocator, protected ?ManagerRegistry $managerRegistry, ?LoggerInterface $logger = null, protected ?array $properties = null, @@ -68,10 +69,15 @@ final class GatewayFilter extends AbstractFilter private function getGatewayName(mixed $value): string { - /** @var GatewayApiResource */ - $gateway = $this->iriConverter->getResourceFromIri($value); + $value = \array_slice(\explode('/', $value), -1)[0]; - return $gateway->name; + try { + $gateway = $this->gatewayLocator->get($value); + + return $gateway::getName(); + } catch (MissingGatewayException $e) { + throw new NotFoundHttpException($e->getMessage()); + } } public function getDescription(string $resourceClass): array