-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FRW-7936 Allow to provide store name as part of URL path. (#2529)
FRW-7936 Allow to provide store name as part of URL path.
- Loading branch information
1 parent
0823924
commit a68d3c9
Showing
2 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...op/Yves/StorageRouterExtension/Dependency/Plugin/StorageRouterEnhancerPluginInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. | ||
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
*/ | ||
|
||
namespace SprykerShop\Yves\StorageRouterExtension\Dependency\Plugin; | ||
|
||
use Symfony\Component\Routing\RequestContext; | ||
|
||
interface StorageRouterEnhancerPluginInterface | ||
{ | ||
/** | ||
* Specification: | ||
* - Returns a manipulated pathinfo. | ||
* - Can be used to e.g. remove optional prefix from pathinfo. | ||
* | ||
* Symfony's routing component doesn't allow to have optional URL parameter before non-optional ones. | ||
* | ||
* We need to allow projects to use optional arguments in the URL e.g. `/{store}/{locale}/foo-bar`. | ||
* The configured route will only have an URL like `/foo-bar` without the optional arguments but we need to be able | ||
* to match an incoming route like `/de/de/foo-bar` to the configured one. | ||
* | ||
* This method will "normalize" the incoming URL to be matchable. | ||
* | ||
* @api | ||
* | ||
* @param string $pathinfo | ||
* @param \Symfony\Component\Routing\RequestContext $requestContext | ||
* | ||
* @return string | ||
*/ | ||
public function beforeMatch(string $pathinfo, RequestContext $requestContext): string; | ||
|
||
/** | ||
* Specification: | ||
* - Adds additional information to the matched $parameters. | ||
* | ||
* @api | ||
* | ||
* @param array<mixed> $parameters | ||
* @param \Symfony\Component\Routing\RequestContext $requestContext | ||
* | ||
* @return array<mixed> | ||
*/ | ||
public function afterMatch(array $parameters, RequestContext $requestContext): array; | ||
|
||
/** | ||
* Specification: | ||
* - Returns a manipulated url after it was generated. | ||
* - Can be used to e.g. add an optional argument to the URL. | ||
* | ||
* Symfony's routing component doesn't allow to have optional URL parameter before non-optional ones. | ||
* | ||
* We need to allow projects to use optional arguments in the URL e.g. `/{store}/{locale}/foo-bar`. | ||
* The configured route will only have an URL like `/foo-bar` with a route name e.g. `foo-bar`. After the generator | ||
* was able to generate an URL by the given route name we need to add the optional arguments to | ||
* return an URL like `/de/de/foo-bar`. | ||
* | ||
* This method will "normalize" the outgoing URL after it was generated. | ||
* | ||
* @api | ||
* | ||
* @param string $url | ||
* @param \Symfony\Component\Routing\RequestContext $requestContext | ||
* @param int $referenceType | ||
* | ||
* @return string | ||
*/ | ||
public function afterGenerate(string $url, RequestContext $requestContext, int $referenceType): string; | ||
} |