Skip to content

Commit

Permalink
minor #302 Use interfaces instead of FQCN as services ids + minor fil…
Browse files Browse the repository at this point in the history
…es refactor (GSadee)

This PR was merged into the 1.0-dev branch.

Discussion
----------



Commits
-------

5859e2b Use interfaces instead of FQCN as services ids + minor files refactor
  • Loading branch information
Zales0123 authored Jun 1, 2021
2 parents 490ff0e + 5859e2b commit f11c9e8
Show file tree
Hide file tree
Showing 19 changed files with 353 additions and 233 deletions.
109 changes: 23 additions & 86 deletions src/Resources/config/services.xml
Original file line number Diff line number Diff line change
@@ -1,122 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>

<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">
<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"
>
<imports>
<import resource="services/actions.xml" />
<import resource="services/command_bus.xml" />
<import resource="services/converter.xml" />
<import resource="services/event_bus.xml" />
<import resource="services/factory.xml" />
<import resource="services/generator.xml" />
<import resource="services/provider.xml" />
<import resource="services/validator.xml" />
<import resource="services/**/*.xml" />
</imports>

<services>
<defaults autowire="false" autoconfigure="false" public="true" />

<service id="Sylius\RefundPlugin\Creator\RefundCreator">
<argument type="service" id="sylius_refund.factory.refund" />
<argument type="service" id="Sylius\RefundPlugin\Provider\RemainingTotalProvider" />
<argument type="service" id="sylius_refund.manager.refund" />
</service>
<service id="Sylius\RefundPlugin\Creator\RefundUnitsCommandCreator">
<argument type="service" id="Sylius\RefundPlugin\Calculator\UnitRefundTotalCalculator" />
<service id="Sylius\RefundPlugin\Calculator\UnitRefundTotalCalculatorInterface" class="Sylius\RefundPlugin\Calculator\UnitRefundTotalCalculator">
<argument type="service" id="Sylius\RefundPlugin\Provider\RemainingTotalProviderInterface" />
</service>

<service id="Sylius\RefundPlugin\Calculator\UnitRefundTotalCalculator">
<argument type="service" id="Sylius\RefundPlugin\Provider\RemainingTotalProvider" />
<service id="Sylius\RefundPlugin\Calculator\UnitRefundTotalCalculator" alias="Sylius\RefundPlugin\Calculator\UnitRefundTotalCalculatorInterface">
<deprecated>The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Calculator\UnitRefundTotalCalculatorInterface instead.</deprecated>
</service>

<service id="Sylius\RefundPlugin\Refunder\OrderItemUnitsRefunder">
<argument type="service" id="Sylius\RefundPlugin\Creator\RefundCreator" />
<argument type="service" id="Sylius\RefundPlugin\Creator\RefundCreatorInterface" />
<argument type="service" id="sylius.event_bus" />
</service>

<service id="Sylius\RefundPlugin\Refunder\OrderShipmentsRefunder">
<argument type="service" id="Sylius\RefundPlugin\Creator\RefundCreator" />
<argument type="service" id="Sylius\RefundPlugin\Creator\RefundCreatorInterface" />
<argument type="service" id="sylius.event_bus" />
</service>

<service id="Sylius\RefundPlugin\Checker\OrderRefundingAvailabilityChecker">
<argument type="service" id="sylius.repository.order" />
</service>
<service id="Sylius\RefundPlugin\Checker\OrderRefundsListAvailabilityChecker">
<argument type="service" id="sylius.repository.order" />
</service>

<service id="Sylius\RefundPlugin\Checker\UnitRefundingAvailabilityChecker">
<argument type="service" id="Sylius\RefundPlugin\Provider\RemainingTotalProvider" />
</service>

<service id="Sylius\RefundPlugin\Twig\OrderRefundsExtension">
<argument type="service" id="Sylius\RefundPlugin\Provider\OrderRefundedTotalProvider" />
<argument type="service" id="Sylius\RefundPlugin\Provider\UnitRefundedTotalProvider" />
<argument type="service" id="Sylius\RefundPlugin\Checker\UnitRefundingAvailabilityChecker" />
<argument type="service" id="Sylius\RefundPlugin\Provider\OrderRefundedTotalProviderInterface" />
<argument type="service" id="Sylius\RefundPlugin\Provider\UnitRefundedTotalProviderInterface" />
<argument type="service" id="Sylius\RefundPlugin\Checker\UnitRefundingAvailabilityCheckerInterface" />
<tag name="twig.extension"/>
</service>

<service id="Sylius\RefundPlugin\Menu\OrderShowMenuListener">
<argument type="service" id="Sylius\RefundPlugin\Checker\OrderRefundsListAvailabilityChecker" />
<tag name="kernel.event_listener" event="sylius.menu.admin.order.show" method="addRefundsButton" />
</service>
<service id="Sylius\RefundPlugin\Menu\AdminMainMenuListener">
<tag name="kernel.event_listener" event="sylius.menu.admin.main" method="addCreditMemosSection" />
</service>

<service id="Sylius\RefundPlugin\StateResolver\OrderFullyRefundedStateResolver">
<argument type="service" id="sm.factory" />
<argument type="service" id="sylius.manager.order" />
<argument type="service" id="Sylius\RefundPlugin\Checker\OrderFullyRefundedTotalChecker" />
<argument type="service" id="sylius.repository.order" />
</service>

<service id="Sylius\RefundPlugin\StateResolver\OrderPartiallyRefundedStateResolver">
<argument type="service" id="sylius.repository.order" />
<argument type="service" id="sm.factory" />
<argument type="service" id="sylius.manager.order" />
</service>

<service id="Sylius\RefundPlugin\Checker\OrderFullyRefundedTotalChecker">
<argument type="service" id="Sylius\RefundPlugin\Provider\OrderRefundedTotalProvider" />
</service>

<service id="sylius_refund_plugin.block_event_listener.order_show.credit_memos" class="Sylius\Bundle\UiBundle\Block\BlockEventListener">
<argument>@SyliusRefundPlugin/Order/Admin/creditMemos.html.twig</argument>
<tag name="kernel.event_listener" event="sonata.block.event.sylius.admin.order.show.after_summary" method="onBlockEvent" />
</service>

<service id="sylius_refund_plugin.block_event_listener.order_show.refund_payments" class="Sylius\Bundle\UiBundle\Block\BlockEventListener">
<argument>@SyliusRefundPlugin/Order/Admin/refundPayments.html.twig</argument>
<tag name="kernel.event_listener" event="sonata.block.event.sylius.admin.order.show.after_summary" method="onBlockEvent" />
</service>

<service id="sylius_refund_plugin.repository.credit_memo_sequence" class="Doctrine\ORM\EntityRepository">
<factory service="doctrine.orm.entity_manager" method="getRepository"/>
<argument type="string">Sylius\RefundPlugin\Entity\CreditMemoSequence</argument>
</service>

<service id="Sylius\RefundPlugin\Sender\CreditMemoEmailSender">
<argument type="service" id="Sylius\RefundPlugin\Generator\CreditMemoPdfFileGenerator" />
<service id="Sylius\RefundPlugin\Sender\CreditMemoEmailSenderInterface" class="Sylius\RefundPlugin\Sender\CreditMemoEmailSender">
<argument type="service" id="Sylius\RefundPlugin\Generator\CreditMemoPdfFileGeneratorInterface" />
<argument type="service" id="sylius.email_sender" />
<argument type="service" id="Sylius\RefundPlugin\File\TemporaryFileManager" />
</service>

<service id="sylius_refund_plugin.block_event_listener.account.order_show" class="Sylius\Bundle\UiBundle\Block\BlockEventListener">
<argument>@SyliusRefundPlugin/Order/Shop/creditMemos.html.twig</argument>
<tag name="kernel.event_listener" event="sonata.block.event.sylius.shop.account.order.show.after_summary" method="onBlockEvent" />
<service id="Sylius\RefundPlugin\Sender\CreditMemoEmailSender" alias="Sylius\RefundPlugin\Sender\CreditMemoEmailSenderInterface">
<deprecated>The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Sender\CreditMemoEmailSenderInterface instead.</deprecated>
</service>

<service id="Sylius\RefundPlugin\File\TemporaryFileManager" />

<service id="Sylius\RefundPlugin\StateResolver\RefundPaymentCompletedStateApplier">
<argument type="service" id="sm.factory" />
<argument type="service" id="sylius_refund.manager.refund_payment" />
</service>

<service id="Sylius\RefundPlugin\ResponseBuilder\CreditMemoFileResponseBuilder" />

<service id="Sylius\RefundPlugin\Checker\CreditMemoCustomerRelationChecker">
<argument type="service" id="sylius.context.customer"/>
<argument type="service" id="sylius_refund.repository.credit_memo"/>
<service id="Sylius\RefundPlugin\ResponseBuilder\CreditMemoFileResponseBuilderInterface" class="Sylius\RefundPlugin\ResponseBuilder\CreditMemoFileResponseBuilder" />
<service id="Sylius\RefundPlugin\ResponseBuilder\CreditMemoFileResponseBuilder" alias="Sylius\RefundPlugin\ResponseBuilder\CreditMemoFileResponseBuilderInterface">
<deprecated>The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\ResponseBuilder\CreditMemoFileResponseBuilderInterface instead.</deprecated>
</service>
</services>
</container>
14 changes: 7 additions & 7 deletions src/Resources/config/services/actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<defaults autowire="false" autoconfigure="false" public="true" />

<service id="Sylius\RefundPlugin\Action\Admin\DownloadCreditMemoAction">
<argument type="service" id="Sylius\RefundPlugin\Generator\CreditMemoPdfFileGenerator" />
<argument type="service" id="Sylius\RefundPlugin\ResponseBuilder\CreditMemoFileResponseBuilder"/>
<argument type="service" id="Sylius\RefundPlugin\Generator\CreditMemoPdfFileGeneratorInterface" />
<argument type="service" id="Sylius\RefundPlugin\ResponseBuilder\CreditMemoFileResponseBuilderInterface" />
</service>

<service id="Sylius\RefundPlugin\Action\Shop\DownloadCreditMemoAction">
<argument type="service" id="Sylius\RefundPlugin\Generator\CreditMemoPdfFileGenerator" />
<argument type="service" id="Sylius\RefundPlugin\Checker\CreditMemoCustomerRelationChecker"/>
<argument type="service" id="Sylius\RefundPlugin\ResponseBuilder\CreditMemoFileResponseBuilder"/>
<argument type="service" id="Sylius\RefundPlugin\Generator\CreditMemoPdfFileGeneratorInterface" />
<argument type="service" id="Sylius\RefundPlugin\Checker\CreditMemoCustomerRelationCheckerInterface" />
<argument type="service" id="Sylius\RefundPlugin\ResponseBuilder\CreditMemoFileResponseBuilderInterface" />
</service>

<service id="Sylius\RefundPlugin\Action\Admin\OrderRefundsListAction">
Expand All @@ -28,15 +28,15 @@
<argument type="service" id="sylius.command_bus" />
<argument type="service" id="session" />
<argument type="service" id="router" />
<argument type="service" id="Sylius\RefundPlugin\Creator\RefundUnitsCommandCreator" />
<argument type="service" id="Sylius\RefundPlugin\Creator\RefundUnitsCommandCreatorInterface" />
<argument type="service" id="monolog.logger" />
</service>

<service id="Sylius\RefundPlugin\Action\CompleteRefundPaymentAction">
<argument type="service" id="session" />
<argument type="service" id="sylius_refund.repository.refund_payment" />
<argument type="service" id="sylius.repository.order" />
<argument type="service" id="Sylius\RefundPlugin\StateResolver\RefundPaymentCompletedStateApplier" />
<argument type="service" id="Sylius\RefundPlugin\StateResolver\RefundPaymentCompletedStateApplierInterface" />
<argument type="service" id="router" />
</service>

Expand Down
40 changes: 40 additions & 0 deletions src/Resources/config/services/checkers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>

<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"
>
<services>
<defaults autowire="false" autoconfigure="false" public="true" />

<service id="Sylius\RefundPlugin\Checker\CreditMemoCustomerRelationCheckerInterface" class="Sylius\RefundPlugin\Checker\CreditMemoCustomerRelationChecker">
<argument type="service" id="sylius.context.customer"/>
<argument type="service" id="sylius_refund.repository.credit_memo"/>
</service>
<service id="Sylius\RefundPlugin\Checker\CreditMemoCustomerRelationChecker" alias="Sylius\RefundPlugin\Checker\CreditMemoCustomerRelationCheckerInterface">
<deprecated>The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Checker\CreditMemoCustomerRelationCheckerInterface instead.</deprecated>
</service>

<service id="Sylius\RefundPlugin\Checker\OrderRefundingAvailabilityChecker">
<argument type="service" id="sylius.repository.order" />
</service>

<service id="Sylius\RefundPlugin\Checker\OrderRefundsListAvailabilityChecker">
<argument type="service" id="sylius.repository.order" />
</service>

<service id="Sylius\RefundPlugin\Checker\OrderFullyRefundedTotalCheckerInterface" class="Sylius\RefundPlugin\Checker\OrderFullyRefundedTotalChecker">
<argument type="service" id="Sylius\RefundPlugin\Provider\OrderRefundedTotalProviderInterface" />
</service>
<service id="Sylius\RefundPlugin\Checker\OrderFullyRefundedTotalChecker" alias="Sylius\RefundPlugin\Checker\OrderFullyRefundedTotalCheckerInterface">
<deprecated>The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Checker\OrderFullyRefundedTotalCheckerInterface instead.</deprecated>
</service>

<service id="Sylius\RefundPlugin\Checker\UnitRefundingAvailabilityCheckerInterface" class="Sylius\RefundPlugin\Checker\UnitRefundingAvailabilityChecker">
<argument type="service" id="Sylius\RefundPlugin\Provider\RemainingTotalProviderInterface" />
</service>
<service id="Sylius\RefundPlugin\Checker\UnitRefundingAvailabilityChecker" alias="Sylius\RefundPlugin\Checker\UnitRefundingAvailabilityCheckerInterface">
<deprecated>The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Checker\UnitRefundingAvailabilityCheckerInterface instead.</deprecated>
</service>
</services>
</container>
6 changes: 3 additions & 3 deletions src/Resources/config/services/command_bus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
<argument type="service" id="Sylius\RefundPlugin\Refunder\OrderShipmentsRefunder" />
<argument type="service" id="sylius.event_bus" />
<argument type="service" id="sylius.repository.order" />
<argument type="service" id="Sylius\RefundPlugin\Validator\RefundUnitsCommandValidator" />
<argument type="service" id="Sylius\RefundPlugin\Validator\RefundUnitsCommandValidatorInterface" />
<tag name="messenger.message_handler" bus="sylius.command_bus" />
</service>

<service id="Sylius\RefundPlugin\CommandHandler\GenerateCreditMemoHandler">
<argument type="service" id="Sylius\RefundPlugin\Generator\CreditMemoGenerator" />
<argument type="service" id="Sylius\RefundPlugin\Generator\CreditMemoGeneratorInterface" />
<argument type="service" id="sylius_refund.manager.credit_memo" />
<argument type="service" id="sylius.event_bus" />
<argument type="service" id="sylius.repository.order" />
Expand All @@ -23,7 +23,7 @@

<service id="Sylius\RefundPlugin\CommandHandler\SendCreditMemoHandler" >
<argument type="service" id="sylius_refund.repository.credit_memo"/>
<argument type="service" id="Sylius\RefundPlugin\Sender\CreditMemoEmailSender"/>
<argument type="service" id="Sylius\RefundPlugin\Sender\CreditMemoEmailSenderInterface" />
<tag name="messenger.message_handler" bus="sylius.command_bus" />
</service>
</services>
Expand Down
File renamed without changes.
26 changes: 26 additions & 0 deletions src/Resources/config/services/creators.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>

<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"
>
<services>
<defaults autowire="false" autoconfigure="false" public="true" />

<service id="Sylius\RefundPlugin\Creator\RefundCreatorInterface" class="Sylius\RefundPlugin\Creator\RefundCreator">
<argument type="service" id="sylius_refund.factory.refund" />
<argument type="service" id="Sylius\RefundPlugin\Provider\RemainingTotalProviderInterface" />
<argument type="service" id="sylius_refund.manager.refund" />
</service>
<service id="Sylius\RefundPlugin\Creator\RefundCreator" alias="Sylius\RefundPlugin\Creator\RefundCreatorInterface">
<deprecated>The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Creator\RefundCreatorInterface instead.</deprecated>
</service>

<service id="Sylius\RefundPlugin\Creator\RefundUnitsCommandCreatorInterface" class="Sylius\RefundPlugin\Creator\RefundUnitsCommandCreator">
<argument type="service" id="Sylius\RefundPlugin\Calculator\UnitRefundTotalCalculatorInterface" />
</service>
<service id="Sylius\RefundPlugin\Creator\RefundUnitsCommandCreator" alias="Sylius\RefundPlugin\Creator\RefundUnitsCommandCreatorInterface">
<deprecated>The "%alias_id%" service alias is deprecated and will be removed in RefundPlugin 1.0, use Sylius\RefundPlugin\Creator\RefundUnitsCommandCreatorInterface instead.</deprecated>
</service>
</services>
</container>
8 changes: 4 additions & 4 deletions src/Resources/config/services/event_bus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
</service>

<service id="Sylius\RefundPlugin\Listener\UnitRefundedEventListener">
<argument type="service" id="Sylius\RefundPlugin\StateResolver\OrderPartiallyRefundedStateResolver" />
<argument type="service" id="Sylius\RefundPlugin\StateResolver\OrderPartiallyRefundedStateResolverInterface" />
<tag name="messenger.message_handler" bus="sylius.event_bus" />
</service>

<service id="Sylius\RefundPlugin\Listener\ShipmentRefundedEventListener">
<argument type="service" id="Sylius\RefundPlugin\StateResolver\OrderPartiallyRefundedStateResolver" />
<argument type="service" id="Sylius\RefundPlugin\StateResolver\OrderPartiallyRefundedStateResolverInterface" />
<tag name="messenger.message_handler" bus="sylius.event_bus" />
</service>

Expand All @@ -28,9 +28,9 @@
</service>

<service id="Sylius\RefundPlugin\ProcessManager\RefundPaymentProcessManager">
<argument type="service" id="Sylius\RefundPlugin\StateResolver\OrderFullyRefundedStateResolver" />
<argument type="service" id="Sylius\RefundPlugin\StateResolver\OrderFullyRefundedStateResolverInterface" />
<argument type="service" id="Sylius\RefundPlugin\Provider\RelatedPaymentIdProviderInterface" />
<argument type="service" id="Sylius\RefundPlugin\Factory\RefundPaymentFactory" />
<argument type="service" id="Sylius\RefundPlugin\Factory\RefundPaymentFactoryInterface" />
<argument type="service" id="doctrine.orm.default_entity_manager" />
<argument type="service" id="sylius.event_bus" />
<tag name="sylius_refund.units_refunded.process_step" priority="50" />
Expand Down
Loading

0 comments on commit f11c9e8

Please sign in to comment.