Skip to content

Commit

Permalink
Adding new routes
Browse files Browse the repository at this point in the history
  • Loading branch information
mamazu committed Apr 5, 2019
1 parent f42f6d6 commit f10503b
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __invoke(Request $request): Response
{
try {
return $this->viewHandler->handle(View::create($this->productCatalogQuery->findByTaxonSlug(
$request->attributes->get('taxonSlug'),
$request->attributes->get('slug'),
$request->attributes->get('channelCode'),
new PaginatorDetails($request->attributes->get('_route'), $request->query->all()),
$request->query->get('locale')
Expand Down
33 changes: 29 additions & 4 deletions src/Resources/config/routing/productByCode.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,48 @@
sylius_shop_api_product_show_details_by_code:
sylius_shop_api_product_show_details_by_code_deprecated:
path: /products/{code}
methods: [GET]
defaults:
_controller: sylius.shop_api_plugin.controller.product.show_product_details_by_code_action

sylius_shop_api_product_show_catalog_by_code:
sylius_shop_api_product_show_catalog_by_code_deprecated:
path: /taxon-products/{code}
methods: [GET]
defaults:
_controller: sylius.shop_api_plugin.controller.product.show_product_catalog_by_taxon_code_action

sylius_shop_api_product_show_reviews_by_code:
sylius_shop_api_product_show_reviews_by_code_depricated:
path: /products/{code}/reviews
methods: [GET]
defaults:
_controller: sylius.shop_api_plugin.controller.product.show_product_reviews_by_code_action

sylius_shop_api_add_product_review_by_code:
sylius_shop_api_add_product_review_by_code_deprecated:
path: /products/{code}/reviews
methods: [POST]
defaults:
_controller: sylius.shop_api_plugin.controller.product.add_review_by_code_action

# New routes
sylius_shop_api_product_show_details_by_code:
path: /products/by-code/{code}
methods: [GET]
defaults:
_controller: sylius.shop_api_plugin.controller.product.show_product_details_by_code_action

sylius_shop_api_product_show_catalog_by_code:
path: /taxon-products/by-code/{code}
methods: [GET]
defaults:
_controller: sylius.shop_api_plugin.controller.product.show_product_catalog_by_taxon_code_action

sylius_shop_api_product_show_reviews_by_code:
path: /products/by-code/{code}/reviews
methods: [GET]
defaults:
_controller: sylius.shop_api_plugin.controller.product.show_product_reviews_by_code_action

sylius_shop_api_add_product_review_by_code:
path: /products/by-code/{code}/reviews
methods: [POST]
defaults:
_controller: sylius.shop_api_plugin.controller.product.add_review_by_code_action
41 changes: 29 additions & 12 deletions src/Resources/config/routing/productBySlug.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,48 @@
sylius_shop_api_product_show_details_by_slug:
sylius_shop_api_product_show_details_by_slug_deprecated:
path: /products-by-slug/{slug}
methods: [GET]
defaults:
_controller: sylius.shop_api_plugin.controller.product.show_product_details_by_slug_action
requirements:
slug: .+

sylius_shop_api_add_product_review_by_slug:
sylius_shop_api_add_product_review_by_slug_deprecated:
path: /product-reviews-by-slug/{slug}
methods: [POST]
defaults:
_controller: sylius.shop_api_plugin.controller.product.add_review_by_slug_action
requirements:
slug: .+

sylius_shop_api_product_show_catalog_by_slug:
sylius_shop_api_product_show_catalog_by_slug_deprecated:
path: /taxon-products-by-slug/{taxonSlug}
methods: [GET]
defaults:
_controller: sylius.shop_api_plugin.controller.product.show_product_catalog_by_taxon_slug_action
requirements:
taxonSlug: .+

sylius_shop_api_product_show_reviews_by_slug:
sylius_shop_api_product_show_reviews_by_slug_deprecated:
path: /product-reviews-by-slug/{slug}
methods: [GET]
defaults:
_controller: sylius.shop_api_plugin.controller.product.show_product_reviews_by_slug_action
requirements:
slug: .+

# New routes
sylius_shop_api_product_show_details_by_slug:
path: /products/by-slug/{slug}
methods: [GET]
defaults:
_controller: sylius.shop_api_plugin.controller.product.show_product_details_by_slug_action

sylius_shop_api_product_show_catalog_by_slug:
path: /taxon-products/by-slug/{slug}
methods: [GET]
defaults:
_controller: sylius.shop_api_plugin.controller.product.show_product_catalog_by_taxon_slug_action

sylius_shop_api_product_show_reviews_by_slug:
path: /product/by-slug/{slug}/reviews
methods: [GET]
defaults:
_controller: sylius.shop_api_plugin.controller.product.show_product_reviews_by_slug_action

sylius_shop_api_add_product_review_by_slug:
path: /product/by-slug/{slug}/reviews
methods: [POST]
defaults:
_controller: sylius.shop_api_plugin.controller.product.add_review_by_slug_action

0 comments on commit f10503b

Please sign in to comment.