Skip to content

Commit ebf5df7

Browse files
authored
Merge pull request #33 from delyriand/fix/route-condition
Routes condition: we only check if nocommerce is active because we have api in the list
2 parents 69f92d9 + 30f1c43 commit ebf5df7

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/Collector/NoCommerceSyliusCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function getDefaultLocaleCode(): ?string
107107
* @SuppressWarnings(PHPMD.EmptyCatchBlock)
108108
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
109109
*/
110-
public function collect(Request $request, Response $response, Throwable $exception = null): void
110+
public function collect(Request $request, Response $response, ?Throwable $exception = null): void
111111
{
112112
try {
113113
/** @var ChannelInterface $channel */

src/Kernel/SyliusNoCommerceKernelTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public function loadRoutes(LoaderInterface $loader): RouteCollection
216216
foreach ($collection as $name => $route) {
217217
foreach ($routesToRemove as $routeToRemove) {
218218
if (false !== strpos($name, $routeToRemove)) {
219-
$route->setCondition("not(context.getPathInfo() matches '`^%sylius.security.new_api_route%`') and not context.checkNoCommerce()");
219+
$route->setCondition('not context.checkNoCommerce()');
220220
}
221221
}
222222
}

src/Provider/FeaturesProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(
3232
$this->nocommerceSettings = $nocommerceSettings;
3333
}
3434

35-
public function isNoCommerceEnabledForChannel(ChannelInterface $channel = null): bool
35+
public function isNoCommerceEnabledForChannel(?ChannelInterface $channel = null): bool
3636
{
3737
try {
3838
if (null === $channel) {

src/Provider/FeaturesProviderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717

1818
interface FeaturesProviderInterface
1919
{
20-
public function isNoCommerceEnabledForChannel(ChannelInterface $channel = null): bool;
20+
public function isNoCommerceEnabledForChannel(?ChannelInterface $channel = null): bool;
2121
}

0 commit comments

Comments
 (0)