From 9a6b92a7ebd6a25d65b1c40590d6a8521271c58b Mon Sep 17 00:00:00 2001 From: Francis Hilaire Date: Mon, 11 Nov 2024 20:30:35 +0100 Subject: [PATCH] Clean and separate configs --- .../winzou_state_machine.yaml | 0 config/app/twig_hooks.yaml | 2 ++ config/config.yaml | 2 +- config/services.yaml | 2 +- .../integrations/sylius_shop.yaml | 0 .../sylius_shop/http_reponse_providers.yaml | 0 .../integrations/sylius_shop/providers.yaml | 0 config/services/listeners.yaml | 2 ++ config/services/state_machine.yaml | 11 +++-------- config/services/stripe.yaml | 2 ++ public/.gitkeep | 0 .../FluxSESyliusStripeExtension.php | 19 ++++++++----------- 12 files changed, 19 insertions(+), 21 deletions(-) rename config/app/{ => integrations}/winzou_state_machine.yaml (100%) create mode 100644 config/app/twig_hooks.yaml rename config/{ => services}/integrations/sylius_shop.yaml (100%) rename config/{ => services}/integrations/sylius_shop/http_reponse_providers.yaml (100%) rename config/{ => services}/integrations/sylius_shop/providers.yaml (100%) create mode 100644 config/services/listeners.yaml create mode 100644 config/services/stripe.yaml delete mode 100644 public/.gitkeep diff --git a/config/app/winzou_state_machine.yaml b/config/app/integrations/winzou_state_machine.yaml similarity index 100% rename from config/app/winzou_state_machine.yaml rename to config/app/integrations/winzou_state_machine.yaml diff --git a/config/app/twig_hooks.yaml b/config/app/twig_hooks.yaml new file mode 100644 index 0000000..239a74a --- /dev/null +++ b/config/app/twig_hooks.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: 'twig_hooks/**/*.yaml' } diff --git a/config/config.yaml b/config/config.yaml index 7d8caf4..f04e126 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -1,2 +1,2 @@ imports: - - { resource: 'app/**/*.yaml' } + - { resource: 'app/*.yaml' } diff --git a/config/services.yaml b/config/services.yaml index 111d586..644c8d2 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -1,2 +1,2 @@ imports: - - { resource: 'services/**/*.yaml' } + - { resource: 'services/*.yaml' } diff --git a/config/integrations/sylius_shop.yaml b/config/services/integrations/sylius_shop.yaml similarity index 100% rename from config/integrations/sylius_shop.yaml rename to config/services/integrations/sylius_shop.yaml diff --git a/config/integrations/sylius_shop/http_reponse_providers.yaml b/config/services/integrations/sylius_shop/http_reponse_providers.yaml similarity index 100% rename from config/integrations/sylius_shop/http_reponse_providers.yaml rename to config/services/integrations/sylius_shop/http_reponse_providers.yaml diff --git a/config/integrations/sylius_shop/providers.yaml b/config/services/integrations/sylius_shop/providers.yaml similarity index 100% rename from config/integrations/sylius_shop/providers.yaml rename to config/services/integrations/sylius_shop/providers.yaml diff --git a/config/services/listeners.yaml b/config/services/listeners.yaml new file mode 100644 index 0000000..057cfaa --- /dev/null +++ b/config/services/listeners.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: 'listeners/workflow/*.yaml' } diff --git a/config/services/state_machine.yaml b/config/services/state_machine.yaml index 90222f3..abf2d4b 100644 --- a/config/services/state_machine.yaml +++ b/config/services/state_machine.yaml @@ -18,7 +18,6 @@ services: flux_se.sylius_stripe.state_machine.refund: public: true - class: FluxSE\SyliusStripePlugin\StateMachine\PaymentStateProcessorInterface parent: flux_se.sylius_stripe.state_machine.payment_state arguments: - [] @@ -27,22 +26,18 @@ services: flux_se.sylius_stripe.state_machine.cancel: public: true - class: FluxSE\SyliusStripePlugin\StateMachine\PaymentStateProcessorInterface parent: flux_se.sylius_stripe.state_machine.payment_state arguments: - - - - !php/const Sylius\Component\Payment\Model\PaymentInterface::STATE_NEW - - !php/const Sylius\Component\Payment\Model\PaymentInterface::STATE_AUTHORIZED + - 0: !php/const Sylius\Component\Payment\Model\PaymentInterface::STATE_NEW + 1: !php/const Sylius\Component\Payment\Model\PaymentInterface::STATE_AUTHORIZED - !php/const Sylius\Component\Payment\Model\PaymentInterface::STATE_CANCELLED - !php/const Sylius\Component\Payment\Model\PaymentRequestInterface::ACTION_CANCEL flux_se.sylius_stripe.state_machine.capture_authorized: public: true - class: FluxSE\SyliusStripePlugin\StateMachine\PaymentStateProcessorInterface parent: flux_se.sylius_stripe.state_machine.payment_state arguments: - - - - !php/const Sylius\Component\Payment\Model\PaymentInterface::STATE_AUTHORIZED + - 0: !php/const Sylius\Component\Payment\Model\PaymentInterface::STATE_AUTHORIZED - !php/const Sylius\Component\Payment\Model\PaymentInterface::STATE_COMPLETED - !php/const Sylius\Component\Payment\Model\PaymentRequestInterface::ACTION_AUTHORIZE diff --git a/config/services/stripe.yaml b/config/services/stripe.yaml new file mode 100644 index 0000000..e99f797 --- /dev/null +++ b/config/services/stripe.yaml @@ -0,0 +1,2 @@ +imports: + - { resource: 'stripe/*.yaml' } diff --git a/public/.gitkeep b/public/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/DependencyInjection/FluxSESyliusStripeExtension.php b/src/DependencyInjection/FluxSESyliusStripeExtension.php index 37d1cef..9a61fc8 100644 --- a/src/DependencyInjection/FluxSESyliusStripeExtension.php +++ b/src/DependencyInjection/FluxSESyliusStripeExtension.php @@ -39,13 +39,19 @@ public function load(array $configs, ContainerBuilder $container): void $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../config')); $loader->load('services.yaml'); + + if ($container->hasParameter('kernel.bundles')) { + /** @var string[] $bundles */ + $bundles = $container->getParameter('kernel.bundles'); + if (array_key_exists('SyliusShopBundle', $bundles)) { + $loader->load('services/integrations/sylius_shop.yaml'); + } + } } public function prepend(ContainerBuilder $container): void { $this->prependDoctrineMigrations($container); - - $this->prependSyliusShop($container); } protected function getMigrationsNamespace(): string @@ -67,13 +73,4 @@ protected function getNamespacesOfMigrationsExecutedBefore(): array 'Sylius\Bundle\CoreBundle\Migrations', ]; } - - private function prependSyliusShop(ContainerBuilder $container): void - { - $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../config/integrations')); - - if ($container->hasExtension('sylius_shop')) { - $loader->load('sylius_shop.yaml'); - } - } }