From 34f1b21cd02f1cbfbdad3ac9dec177b713f51441 Mon Sep 17 00:00:00 2001 From: tleon Date: Thu, 15 Feb 2024 16:18:50 +0100 Subject: [PATCH] chore(api): update product search with custom operation --- src/ApiPlatform/Resources/FoundProduct.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ApiPlatform/Resources/FoundProduct.php b/src/ApiPlatform/Resources/FoundProduct.php index 2118975..b42aab6 100644 --- a/src/ApiPlatform/Resources/FoundProduct.php +++ b/src/ApiPlatform/Resources/FoundProduct.php @@ -30,13 +30,13 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; -use ApiPlatform\Metadata\GetCollection; use PrestaShop\PrestaShop\Core\Domain\Product\Query\SearchProducts; +use PrestaShopBundle\ApiPlatform\Metadata\CQRSQueryCollection; use PrestaShopBundle\ApiPlatform\Provider\QueryProvider; #[ApiResource( operations: [ - new GetCollection( + new CQRSQueryCollection( uriTemplate: '/products/search/{phrase}/{resultsLimit}/{isoCode}', openapiContext: [ 'parameters' => [ @@ -75,9 +75,7 @@ ], ], provider: QueryProvider::class, - extraProperties: [ - 'CQRSQuery' => SearchProducts::class, - ] + CQRSQuery: SearchProducts::class ), ], )]