Skip to content

Commit 3bf24e4

Browse files
committed
Add Resource Route Collection Factory
1 parent c98f1a3 commit 3bf24e4

File tree

17 files changed

+374
-10
lines changed

17 files changed

+374
-10
lines changed

psalm.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,20 @@
4646
<DeprecatedClass>
4747
<errorLevel type="info">
4848
<referencedClass name="Doctrine\ORM\Event\LifecycleEventArgs" /> <!-- deprecated in doctrine/orm 2.14 -->
49+
</errorLevel>
50+
<errorLevel type="suppress">
4951
<referencedClass name="Sylius\Component\Resource\Exception\VariantWithNoOptionsValuesException" />
5052
<referencedClass name="Sylius\Resource\Exception\VariantWithNoOptionsValuesException" />
53+
<referencedClass name="Sylius\Resource\Symfony\Routing\Factory\AttributesOperationRouteFactory" />
5154
</errorLevel>
5255
</DeprecatedClass>
5356

57+
<DeprecatedInterface>
58+
<errorLevel type="suppress">
59+
<referencedClass name="Sylius\Resource\Symfony\Routing\Factory\AttributesOperationRouteFactoryInterface" />
60+
</errorLevel>
61+
</DeprecatedInterface>
62+
5463
<DeprecatedMethod>
5564
<errorLevel type="suppress">
5665
<referencedMethod name="Symfony\Component\EventDispatcher\Event::isPropagationStopped" />

src/Bundle/Resources/config/services/routing.xml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
-->
1313

1414
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
15+
<imports>
16+
<import resource="routing/**/**.xml" />
17+
</imports>
18+
1519
<services>
1620
<defaults public="true" />
1721

@@ -22,6 +26,7 @@
2226
</argument>
2327
<argument>%kernel.environment%</argument>
2428
<tag name="routing.loader" />
29+
<deprecated package="sylius/resource" version="1.13">The "%service_id%" service is deprecated since sylius/resource-bundle 1.13 and will be removed in sylius/resource-bundle 2.0. Use "sylius_resource.symfony.routing.loader.resource" instead.</deprecated>
2530
</service>
2631
<service id="Sylius\Bundle\ResourceBundle\Routing\ResourceLoader" alias="sylius.routing.loader.resource" public="false" />
2732

@@ -37,6 +42,7 @@
3742
<argument type="service" id="sylius.routing.factory.route_attributes" />
3843
<argument type="service" id="sylius.routing.factory.attributes_operation_route" />
3944
<tag name="routing.route_loader" />
45+
<deprecated package="sylius/resource" version="1.13">The "%service_id%" service is deprecated since sylius/resource-bundle 1.13 and will be removed in sylius/resource-bundle 2.0. Use "sylius_resource.symfony.routing.loader.resource" instead.</deprecated>
4046
</service>
4147
<service id="Sylius\Bundle\ResourceBundle\Routing\RoutesAttributesLoader" alias="sylius.routing.loader.routes_attributes" public="false" />
4248

@@ -99,12 +105,19 @@
99105
<service id="sylius.routing.factory.route_attributes" class="Sylius\Bundle\ResourceBundle\Routing\RouteAttributesFactory" public="false" />
100106
<service id="Sylius\Bundle\ResourceBundle\Routing\RouteAttributesFactoryInterface" alias="sylius.routing.factory.route_attributes" />
101107

102-
<service id="sylius.routing.factory.attributes_operation_route" class="Sylius\Resource\Symfony\Routing\Factory\AttributesOperationRouteFactory" public="false">
108+
<service id="sylius.routing.factory.attributes_operation_route"
109+
class="Sylius\Resource\Symfony\Routing\Factory\AttributesOperationRouteFactory"
110+
public="false"
111+
>
103112
<argument type="service" id="sylius.resource_registry" />
104113
<argument type="service" id="sylius.routing.factory.operation_route" />
105114
<argument type="service" id="sylius.resource_metadata_collection.factory.attributes" />
115+
<deprecated package="sylius/resource-bundle" version="1.13">The "%service_id%" service is deprecated since sylius/resource-bundle 1.13 and will be removed in sylius/resource-bundle 2.0. Use "sylius.routing.resource.route_collection_factory" instead.</deprecated>
116+
</service>
117+
<service id="Sylius\Resource\Symfony\Routing\Factory\AttributesOperationRouteFactoryInterface"
118+
alias="sylius.routing.factory.attributes_operation_route">
119+
<deprecated package="sylius/resource-bundle" version="1.13">The "%alias_id%" service is deprecated since sylius/resource-bundle 1.13 and will be removed in sylius/resource-bundle 2.0. Use "sylius.routing.resource.route_collection_factory" instead.</deprecated>
106120
</service>
107-
<service id="Sylius\Resource\Symfony\Routing\Factory\AttributesOperationRouteFactoryInterface" alias="sylius.routing.factory.attributes_operation_route" />
108121

109122
<service id="sylius.routing.factory.operation_route" class="Sylius\Resource\Symfony\Routing\Factory\OperationRouteFactory" public="false">
110123
<argument type="service" id="sylius.routing.factory.operation_route_path_factory" />
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
5+
This file is part of the Sylius package.
6+
7+
(c) Sylius Sp. z o.o.
8+
9+
For the full copyright and license information, please view the LICENSE
10+
file that was distributed with this source code.
11+
12+
-->
13+
14+
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
15+
<services>
16+
<service id="sylius.symfony.routing.loader.resource" class="Sylius\Resource\Symfony\Routing\Loader\ResourceLoader">
17+
<argument type="service" id="sylius.metadata.resource_class_list.factory" />
18+
<argument type="service" id="sylius.routing.resource.route_collection_factory" />
19+
<tag name="routing.route_loader" />
20+
</service>
21+
<service id="Sylius\Resource\Symfony\Routing\Loader\ResourceLoader" alias="sylius.symfony.routing.loader.resource" />
22+
</services>
23+
</container>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
5+
This file is part of the Sylius package.
6+
7+
(c) Sylius Sp. z o.o.
8+
9+
For the full copyright and license information, please view the LICENSE
10+
file that was distributed with this source code.
11+
12+
-->
13+
14+
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
15+
<services>
16+
<service id="sylius.routing.resource.route_collection_factory" class="Sylius\Resource\Symfony\Routing\Factory\Resource\ResourceRouteCollectionFactory">
17+
<argument type="service" id="sylius.routing.factory.operation_route" />
18+
<argument type="service" id="sylius.resource_metadata_collection.factory.attributes" />
19+
<argument type="service" id="sylius.resource_registry" />
20+
</service>
21+
<service id="Sylius\Resource\Symfony\Routing\Factory\Resource\ResourceRouteCollectionFactoryInterface" alias="sylius.routing.resource.route_collection_factory" />
22+
</services>
23+
</container>

src/Bundle/Routing/ResourceLoader.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
use Symfony\Component\Routing\RouteCollection;
2323
use Symfony\Component\Yaml\Yaml;
2424

25+
/**
26+
* @deprecated use Sylius\Resource\Symfony\Routing\Loader\ResourceLoader instead
27+
*/
2528
final class ResourceLoader extends Loader
2629
{
2730
private RegistryInterface $resourceRegistry;

src/Bundle/Routing/RoutesAttributesLoader.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
use Symfony\Bundle\FrameworkBundle\Routing\RouteLoaderInterface;
1919
use Symfony\Component\Routing\RouteCollection;
2020

21+
/**
22+
* @deprecated use Sylius\Resource\Symfony\Routing\Loader\ResourceLoader instead
23+
*/
2124
final class RoutesAttributesLoader implements RouteLoaderInterface
2225
{
2326
public function __construct(

src/Component/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"pagerfanta/core": "^3.7 || ^4.0",
3535
"symfony/event-dispatcher": "^6.4 || ^7.1",
3636
"symfony/form": "^6.4 || ^7.1",
37+
"symfony/framework-bundle": "^6.4 || ^7.1",
3738
"symfony/http-foundation": "^6.4 || ^7.1",
3839
"symfony/http-kernel": "^6.4 || ^7.1",
3940
"symfony/property-access": "^6.4 || ^7.1",

src/Component/src/Metadata/Resource/Factory/AttributesResourceClassListFactory.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public function __construct(
3838
*/
3939
public function create(): ResourceClassList
4040
{
41-
/** @var class-string[] $classes */
4241
$classes = [];
4342

4443
if ($this->decorated) {

src/Component/src/Symfony/Routing/Factory/AttributesOperationRouteFactory.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@
1919
use Sylius\Resource\Metadata\RegistryInterface;
2020
use Sylius\Resource\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
2121
use Sylius\Resource\Metadata\ResourceMetadata;
22+
use Sylius\Resource\Symfony\Routing\Factory\Resource\ResourceRouteCollectionFactory;
2223
use Symfony\Component\Routing\Route;
2324
use Symfony\Component\Routing\RouteCollection;
2425
use Webmozart\Assert\Assert;
2526

27+
/**
28+
* @deprecated use ResourceRouteCollectionFactory instead
29+
*/
2630
final class AttributesOperationRouteFactory implements AttributesOperationRouteFactoryInterface
2731
{
2832
public function __construct(

src/Component/src/Symfony/Routing/Factory/AttributesOperationRouteFactoryInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
use Symfony\Component\Routing\RouteCollection;
1717

18+
/**
19+
* @deprecated use Sylius\Resource\Symfony\Routing\Factory\Resource\ResourceRouteCollectionFactoryInterface instead
20+
*/
1821
interface AttributesOperationRouteFactoryInterface
1922
{
2023
/** @psalm-param class-string $className */

0 commit comments

Comments
 (0)