-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Link order generation to state machine #283
base: 1.0
Are you sure you want to change the base?
Changes from all commits
1b76e14
a817d69
380941a
7e36063
3ec77e8
f77bc23
3c3a1fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,13 @@ winzou_state_machine: | |
on: ['complete'] | ||
do: ['@sylius_invoicing_plugin.event_producer.order_payment_paid', '__invoke'] | ||
args: ['object'] | ||
sylius_order_checkout: | ||
callbacks: | ||
after: | ||
sylius_invoicing_plugin_order_placed_producer: | ||
on: ['complete'] | ||
do: ['@sylius_invoicing_plugin.event_producer.order_placed', '__invoke'] | ||
args: ['object'] | ||
Comment on lines
+28
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it wouldn't be better to put this logic on the callback after There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ping @Prometee There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @GSadee yes it will make the same thing, but one issue will happen here if the $order = $this->orderFactory->createNew();
/* add product, address and select payment, shipping etc */
$this->stateMachineFactory
->get($order, OrderCheckoutTransitions::GRAPH)
->apply(OrderCheckoutTransitions::TRANSITION_COMPLETE)
; The result will be an error on the To solve this, the I know it's a big change and it will make useless triggering the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if I correctly understand you, is there a problem with moving the callback to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. During the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From my point of view the |
||
|
||
sylius_grid: | ||
templates: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change that in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because
findOneByNumber
refers to OrderRepository method, which verify order is not on cart state. So we have a null value using repository method.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what is the reason the order is in cart state? Because in the moment of creating an invoice the checkout should be completed and the order shouldn't be in the cart state anymore. I guess, but I'm not sure, there is a difference with the moment of dispatching the event between state machine callback and the doctrine events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this moment the order
state
isnew
instead ofcart
in the database.