Skip to content

Commit 3cbb0e9

Browse files
authored
Merge pull request #64 from shopware/fix/replace-xml-with-yaml
fix!: replace xml with php
2 parents 8f69213 + 5d70995 commit 3cbb0e9

File tree

8 files changed

+157
-140
lines changed

8 files changed

+157
-140
lines changed

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@
2020
},
2121
"require": {
2222
"php": ">=8.1",
23-
"symfony/psr-http-message-bridge": "2.* || ^7.0",
24-
"symfony/routing": "^6.4 || ^7.0",
23+
"symfony/psr-http-message-bridge": "2.* || ^7.0 || ^8.0",
24+
"symfony/routing": "^6.4 || ^7.0 || ^8.0",
2525
"shopware/app-php-sdk": ">=4.1.0",
26-
"symfony/http-client": "^6.4 || ^7.0",
26+
"symfony/http-client": "^6.4 || ^7.0 || ^8.0",
2727
"nyholm/psr7": "^1.8"
2828
},
2929
"require-dev": {
3030
"doctrine/doctrine-bundle": "^2.8",
31-
"symfony/doctrine-bridge": "^6.4 || ^7.0",
31+
"symfony/doctrine-bridge": "^6.4 || ^7.0 || ^8.0",
3232
"doctrine/orm": "^3.0",
3333
"async-aws/async-aws-bundle": "~1.12",
3434
"async-aws/dynamo-db": "~3.2.1",
3535
"symfony/polyfill-uuid": "~1.31.0",
3636
"friendsofphp/php-cs-fixer": "^3.16",
3737
"phpstan/phpstan": "^1.10.14",
3838
"phpunit/phpunit": "^10.1",
39-
"symfony/phpunit-bridge": "^6.2.10 || ^6.3 || ^6.4 || ^7.0",
39+
"symfony/phpunit-bridge": "^6.2.10 || ^6.3 || ^6.4 || ^7.0 || ^8.0",
4040
"infection/infection": "^0.26.21"
4141
},
4242
"suggest": {

src/DependencyInjection/ShopwareAppExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Symfony\Component\DependencyInjection\ContainerBuilder;
1515
use Symfony\Component\DependencyInjection\Definition;
1616
use Symfony\Component\DependencyInjection\Extension\Extension;
17-
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
17+
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
1818
use Symfony\Component\DependencyInjection\Reference;
1919

2020
final class ShopwareAppExtension extends Extension
@@ -23,12 +23,12 @@ public function load(array $configs, ContainerBuilder $container): void
2323
{
2424
$config = $this->processConfiguration(new Configuration(), $configs);
2525

26-
$loader = new XmlFileLoader(
26+
$loader = new PhpFileLoader(
2727
$container,
2828
new FileLocator(__DIR__ . '/../Resources/config')
2929
);
3030

31-
$loader->load('services.xml');
31+
$loader->load('services.php');
3232

3333
$storage = $config['storage'];
3434

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Symfony\Component\HttpFoundation\Request;
6+
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
7+
use Shopware\AppBundle\Controller\LifecycleController;
8+
9+
return function (RoutingConfigurator $routes): void {
10+
$routes->add('shopware_app_lifecycle_register', '/lifecycle/register')
11+
->methods([Request::METHOD_GET])
12+
->controller([LifecycleController::class, 'register']);
13+
14+
$routes->add('shopware_app_lifecycle_confirm', '/lifecycle/register-confirm')
15+
->methods([Request::METHOD_POST])
16+
->controller([LifecycleController::class, 'registerConfirm']);
17+
18+
$routes->add('shopware_app_lifecycle_activate', '/lifecycle/activate')
19+
->methods([Request::METHOD_POST])
20+
->controller([LifecycleController::class, 'activate']);
21+
22+
$routes->add('shopware_app_lifecycle_deactivate', '/lifecycle/deactivate')
23+
->methods([Request::METHOD_POST])
24+
->controller([LifecycleController::class, 'deactivate']);
25+
26+
$routes->add('shopware_app_lifecycle_delete', '/lifecycle/delete')
27+
->methods([Request::METHOD_POST])
28+
->controller([LifecycleController::class, 'delete']);
29+
};

src/Resources/config/routing/lifecycle.xml

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Symfony\Component\HttpFoundation\Request;
6+
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
7+
use Shopware\AppBundle\Controller\WebhookController;
8+
9+
return function (RoutingConfigurator $routes): void {
10+
$routes->add('shopware_app_webhook', '/webhook')
11+
->methods([Request::METHOD_POST])
12+
->controller([WebhookController::class, 'dispatch']);
13+
};

src/Resources/config/routing/webhook.xml

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Resources/config/services.php

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
6+
7+
return static function (ContainerConfigurator $container) {
8+
$services = $container->services();
9+
10+
$services->defaults()
11+
->autowire()
12+
->autoconfigure();
13+
14+
$services->set(\Shopware\AppBundle\DependencyInjection\AppConfigurationFactory::class)
15+
->args([
16+
// Will be filled by \Shopware\AppBundle\DependencyInjection\ShopwareAppExtension::load
17+
'',
18+
'',
19+
'',
20+
service(\Symfony\Component\Routing\Generator\UrlGeneratorInterface::class),
21+
]);
22+
23+
$services->set(\Shopware\App\SDK\HttpClient\ClientFactory::class);
24+
25+
$services->set(\Shopware\App\SDK\AppConfiguration::class)
26+
->factory([service(\Shopware\AppBundle\DependencyInjection\AppConfigurationFactory::class), 'newConfiguration']);
27+
28+
$services->set(\Shopware\App\SDK\AppLifecycle::class)
29+
->args([
30+
service(\Shopware\App\SDK\Registration\RegistrationService::class),
31+
service(\Shopware\App\SDK\Shop\ShopResolver::class),
32+
service(\Shopware\App\SDK\Shop\ShopRepositoryInterface::class),
33+
service(\Psr\Log\LoggerInterface::class),
34+
service(\Psr\EventDispatcher\EventDispatcherInterface::class),
35+
]);
36+
37+
$services->set(\Shopware\App\SDK\Authentication\RequestVerifier::class);
38+
39+
$services->set(\Shopware\App\SDK\Authentication\ResponseSigner::class);
40+
41+
$services->set(\Symfony\Component\Cache\Psr16Cache::class)
42+
->args([service('cache.app')]);
43+
44+
$services->set(\Shopware\App\SDK\Context\InAppPurchase\SBPStoreKeyFetcher::class)
45+
->args([
46+
service(\Psr\Http\Client\ClientInterface::class),
47+
service(\Symfony\Component\Cache\Psr16Cache::class),
48+
service(\Psr\Log\LoggerInterface::class),
49+
]);
50+
51+
$services->set(\Shopware\App\SDK\Context\InAppPurchase\InAppPurchaseProvider::class)
52+
->args([
53+
service(\Shopware\App\SDK\Context\InAppPurchase\SBPStoreKeyFetcher::class),
54+
service(\Psr\Log\LoggerInterface::class),
55+
]);
56+
57+
$services->set(\Shopware\App\SDK\Context\ContextResolver::class)
58+
->args([service(\Shopware\App\SDK\Context\InAppPurchase\InAppPurchaseProvider::class)]);
59+
60+
$services->set(\Shopware\App\SDK\Shop\ShopResolver::class)
61+
->args([service(\Shopware\App\SDK\Shop\ShopRepositoryInterface::class)]);
62+
63+
$services->set(\Shopware\App\SDK\Registration\RegistrationService::class)
64+
->args([
65+
service(\Shopware\App\SDK\AppConfiguration::class),
66+
service(\Shopware\App\SDK\Shop\ShopRepositoryInterface::class),
67+
service(\Shopware\App\SDK\Authentication\RequestVerifier::class),
68+
service(\Shopware\App\SDK\Authentication\ResponseSigner::class),
69+
service(\Shopware\App\SDK\Registration\ShopSecretGeneratorInterface::class),
70+
service(\Psr\Log\LoggerInterface::class),
71+
service(\Psr\EventDispatcher\EventDispatcherInterface::class),
72+
]);
73+
74+
$services->set(\Shopware\App\SDK\Registration\ShopSecretGeneratorInterface::class, \Shopware\App\SDK\Registration\RandomStringShopSecretGenerator::class);
75+
76+
$services->set(\Shopware\App\SDK\Shop\ShopRepositoryInterface::class, \Shopware\AppBundle\Entity\ShopRepositoryBridge::class)
77+
->args([
78+
'',
79+
service(\Doctrine\Persistence\ManagerRegistry::class),
80+
]);
81+
82+
$services->set(\Shopware\AppBundle\Controller\LifecycleController::class)
83+
->public()
84+
->args([service(\Shopware\App\SDK\AppLifecycle::class)])
85+
->tag('controller.service_arguments');
86+
87+
$services->set(\Shopware\AppBundle\Controller\WebhookController::class)
88+
->public()
89+
->args([service('event_dispatcher')])
90+
->tag('controller.service_arguments');
91+
92+
$services->set(\Shopware\AppBundle\ArgumentValueResolver\ContextArgumentResolver::class);
93+
94+
$services->set(\Shopware\AppBundle\EventListener\ResponseSignerListener::class);
95+
96+
$services->set(\Shopware\AppBundle\EventListener\BeforeRegistrationStartsListener::class)
97+
->args([
98+
service(\Symfony\Contracts\HttpClient\HttpClientInterface::class),
99+
'%shopware_app.check_if_shop_url_is_reachable%',
100+
]);
101+
102+
$services->set(\Symfony\Bridge\PsrHttpMessage\HttpFoundationFactoryInterface::class, \Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory::class);
103+
104+
$services->set(\Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface::class, \Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory::class);
105+
106+
$services->set(\Symfony\Bridge\PsrHttpMessage\EventListener\PsrResponseListener::class);
107+
};

src/Resources/config/services.xml

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)