Skip to content

Commit

Permalink
chore(api): change querybuilder named parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
tleon committed Apr 11, 2024
1 parent 428e5cb commit be0cf1e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
18 changes: 18 additions & 0 deletions config/admin/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,21 @@ services:
PrestaShop\Module\APIResources\List\ModuleQueryBuilder:
parent: 'prestashop.core.grid.abstract_query_builder'
autowire: true

prestashop.core.grid.data_factory.hook:
class: '%prestashop.core.grid.data.factory.doctrine_grid_data_factory%'
public: true
arguments:
- '@prestashop.core.api.query_builder.hook'
- '@prestashop.core.hook.dispatcher'
- '@prestashop.core.grid.query.doctrine_query_parser'
- 'hook'

prestashop.core.grid.data_factory.module:
class: '%prestashop.core.grid.data.factory.doctrine_grid_data_factory%'
public: true
arguments:
- '@PrestaShop\Module\APIResources\List\ModuleQueryBuilder'
- '@prestashop.core.hook.dispatcher'
- '@prestashop.core.grid.query.doctrine_query_parser'
- 'module'
2 changes: 1 addition & 1 deletion src/ApiPlatform/Resources/Hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
provider: QueryListProvider::class,
scopes: ['hook_read'],
ApiResourceMapping: ['[id_hook]' => '[id]'],
queryBuilder: 'prestashop.core.api.query_builder.hook',
gridDataFactory: 'prestashop.core.grid.data_factory.hook',
),
],
)]
Expand Down
2 changes: 1 addition & 1 deletion src/ApiPlatform/Resources/Module/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
scopes: [
'module_read',
],
queryBuilder: ModuleQueryBuilder::class,
gridDataFactory: 'prestashop.core.grid.data_factory.module',
),
],
)]
Expand Down
3 changes: 2 additions & 1 deletion src/ApiPlatform/Resources/ProductList.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use PrestaShop\PrestaShop\Adapter\Product\Grid\Data\Factory\ProductGridDataFactoryDecorator;
use PrestaShop\PrestaShop\Core\Domain\Product\Exception\ProductNotFoundException;
use PrestaShop\PrestaShop\Core\Domain\Shop\Exception\ShopAssociationNotFound;
use PrestaShop\PrestaShop\Core\Search\Filters\ProductFilters;
Expand All @@ -42,7 +43,7 @@
'[id_product]' => '[productId]',
'[final_price_tax_excluded]' => '[price]',
],
queryBuilder: 'prestashop.core.grid.query_builder.product',
gridDataFactory: ProductGridDataFactoryDecorator::class,
filtersClass: ProductFilters::class,
),
],
Expand Down

0 comments on commit be0cf1e

Please sign in to comment.