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 10, 2024
1 parent 480c00a commit aaf8cfe
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
21 changes: 20 additions & 1 deletion config/admin/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ services:
public: false
autowire: true

PrestaShop\Module\APIResources\List\ModuleQueryBuilder:
prestashop.module.api.list.module_query_builder:
class: '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.api.list.module_query_builder'
- '@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 aaf8cfe

Please sign in to comment.