From f10503b159f3a2d96641948f662ffb0b6cdaec85 Mon Sep 17 00:00:00 2001 From: mamazu Date: Wed, 3 Apr 2019 23:19:13 +0200 Subject: [PATCH] Adding new routes --- .../ShowProductCatalogByTaxonSlugAction.php | 2 +- .../config/routing/productByCode.yml | 33 +++++++++++++-- .../config/routing/productBySlug.yml | 41 +++++++++++++------ 3 files changed, 59 insertions(+), 17 deletions(-) diff --git a/src/Controller/Product/ShowProductCatalogByTaxonSlugAction.php b/src/Controller/Product/ShowProductCatalogByTaxonSlugAction.php index 1dfcf4cb2..ce2eee081 100644 --- a/src/Controller/Product/ShowProductCatalogByTaxonSlugAction.php +++ b/src/Controller/Product/ShowProductCatalogByTaxonSlugAction.php @@ -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') diff --git a/src/Resources/config/routing/productByCode.yml b/src/Resources/config/routing/productByCode.yml index 5756aecd0..623da66f9 100644 --- a/src/Resources/config/routing/productByCode.yml +++ b/src/Resources/config/routing/productByCode.yml @@ -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 diff --git a/src/Resources/config/routing/productBySlug.yml b/src/Resources/config/routing/productBySlug.yml index c33300c50..aedc3a934 100644 --- a/src/Resources/config/routing/productBySlug.yml +++ b/src/Resources/config/routing/productBySlug.yml @@ -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