Skip to content

Commit

Permalink
refactor #288 bus-unification (SirDomin)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.0-dev branch.

Discussion
----------



Commits
-------

2847bb1 bus-unification
58c0cfb add sylius buses
494d6b2 pr fix
bd3b80a fix tags
f08633a update upgrade file
  • Loading branch information
GSadee authored May 19, 2021
2 parents 1d0af81 + f08633a commit 46e6f1b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 20 deletions.
5 changes: 5 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### UPGRADE FROM 1.0.0-RC.9 TO 1.0.0-RC.10

Command bus `sylius_refund_plugin.command_bus` has been replaced with `sylius.command_bus`.
Event bus `sylius_refund_plugin.event_bus` has been replaced with `sylius.event_bus`.

### UPGRADE FROM 1.0.0-RC.7 TO 1.0.0-RC.8

1. The `fully_refunded` state and the `refund` transition have been removed from `sylius_order` state machine.
Expand Down
7 changes: 5 additions & 2 deletions src/Resources/config/app/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ sylius_mailer:
framework:
messenger:
buses:
sylius_refund_plugin.command_bus: ~
sylius_refund_plugin.event_bus:
sylius.command_bus:
middleware:
- 'validation'
- 'doctrine_transaction'
sylius.event_bus:
default_middleware: allow_no_handlers

winzou_state_machine:
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@

<service id="Sylius\RefundPlugin\Refunder\OrderItemUnitsRefunder">
<argument type="service" id="Sylius\RefundPlugin\Creator\RefundCreator" />
<argument type="service" id="sylius_refund_plugin.event_bus" />
<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_refund_plugin.event_bus" />
<argument type="service" id="sylius.event_bus" />
</service>

<service id="Sylius\RefundPlugin\Factory\CreditMemoSequenceFactory" />
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/config/services/actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</service>

<service id="Sylius\RefundPlugin\Action\Admin\RefundUnitsAction">
<argument type="service" id="sylius_refund_plugin.command_bus" />
<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" />
Expand All @@ -41,7 +41,7 @@
</service>

<service id="Sylius\RefundPlugin\Action\Admin\SendCreditMemoAction">
<argument type="service" id="sylius_refund_plugin.command_bus"/>
<argument type="service" id="sylius.command_bus"/>
<argument type="service" id="sylius_refund.repository.credit_memo"/>
<argument type="service" id="session"/>
<argument type="service" id="router"/>
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/config/services/command_bus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
<service id="Sylius\RefundPlugin\CommandHandler\RefundUnitsHandler">
<argument type="service" id="Sylius\RefundPlugin\Refunder\OrderItemUnitsRefunder" />
<argument type="service" id="Sylius\RefundPlugin\Refunder\OrderShipmentsRefunder" />
<argument type="service" id="sylius_refund_plugin.event_bus" />
<argument type="service" id="sylius.event_bus" />
<argument type="service" id="sylius.repository.order" />
<argument type="service" id="Sylius\RefundPlugin\Validator\RefundUnitsCommandValidator" />
<tag name="messenger.message_handler" />
<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_refund.manager.credit_memo" />
<argument type="service" id="sylius_refund_plugin.event_bus" />
<argument type="service" id="sylius.event_bus" />
<argument type="service" id="sylius.repository.order" />
<tag name="messenger.message_handler" />
<tag name="messenger.message_handler"/>
</service>

<service id="Sylius\RefundPlugin\CommandHandler\SendCreditMemoHandler" >
Expand Down
16 changes: 8 additions & 8 deletions src/Resources/config/services/event_bus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@
<defaults autowire="false" autoconfigure="false" public="true" />

<service id="Sylius\RefundPlugin\Listener\CreditMemoGeneratedEventListener">
<argument type="service" id="sylius_refund_plugin.event_bus" />
<tag name="messenger.message_handler" />
<argument type="service" id="sylius.command_bus" />
<tag name="messenger.message_handler" bus="sylius.event_bus" />
</service>

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

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

<service id="Sylius\RefundPlugin\ProcessManager\CreditMemoProcessManager">
<argument type="service" id="sylius_refund_plugin.command_bus" />
<tag name="messenger.message_handler" />
<argument type="service" id="sylius.command_bus" />
<tag name="messenger.message_handler" bus="sylius.event_bus" />
</service>

<service id="Sylius\RefundPlugin\ProcessManager\RefundPaymentProcessManager">
<argument type="service" id="Sylius\RefundPlugin\StateResolver\OrderFullyRefundedStateResolver" />
<argument type="service" id="Sylius\RefundPlugin\Provider\RelatedPaymentIdProviderInterface" />
<argument type="service" id="Sylius\RefundPlugin\Factory\RefundPaymentFactory" />
<argument type="service" id="doctrine.orm.default_entity_manager" />
<argument type="service" id="sylius_refund_plugin.event_bus" />
<tag name="messenger.message_handler" />
<argument type="service" id="sylius.event_bus" />
<tag name="messenger.message_handler" bus="sylius.event_bus" />
</service>
</services>
</container>
4 changes: 2 additions & 2 deletions tests/Behat/Resources/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<argument type="service" id="sylius.repository.order" />
<argument type="service" id="sylius_refund.repository.refund" />
<argument type="service" id="Sylius\RefundPlugin\Provider\RemainingTotalProvider" />
<argument type="service" id="sylius_refund_plugin.command_bus" />
<argument type="service" id="sylius.command_bus" />
<argument type="service" id="sylius.behat.email_checker" />
</service>

Expand Down Expand Up @@ -63,7 +63,7 @@

<service id="Tests\Sylius\RefundPlugin\Behat\Context\Setup\RefundingContext">
<argument type="service" id="sylius.repository.order" />
<argument type="service" id="sylius_refund_plugin.command_bus" />
<argument type="service" id="sylius.command_bus" />
</service>

<service id="Tests\Sylius\RefundPlugin\Behat\Context\Setup\OrderContext">
Expand Down

0 comments on commit 46e6f1b

Please sign in to comment.