What are the Slack Archives?
Itโs a history of our time together in the Slack Community! Thereโs a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you wonโt be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hi, I'm trying to update an order ```$order = new OrderTransfer(); $order->setEmail('
Hi,
I'm trying to update an order
$order = new OrderTransfer(); $order->setEmail('<mailto:steve.rogers@example.org|steve.rogers@example.org>'); /** @var SalesFacadeInterface $salesFacade **/ $salesFacade->updateOrder($order, $orderId);
and I get
Call to a member function getTaxTotal() on null
because during this update OrderUpdater wants to create order totals
protected function createOrderTotals(OrderTransfer $orderTransfer, SpySalesOrder $orderEntity) { $taxTotal = 0; if ($orderTransfer->getTotals()->getTaxTotal()) { $taxTotal = $orderTransfer->getTotals()->getTaxTotal()->getAmount(); } ...
am I doing something wrong or missing something?
Comments
-
That
updateOrder()
method is not prepared to only process adjusted properties imo. So it runs though the update stack that contains lots of different aspects, like the one you encountered.It might be easier (necessary) to create your own custom facade method to cover the particular use case
0 -
The error itself happens as
getTotals()
onOrderTransfer
returns null instead of another TransferObject, as you did not populate it. You couuuuuuld try to create an empty one (TotalsTransfer? not sure) and try once more. But I feel even if it would work at the moment, the risk of this breaking at some point isโฆ too big0 -
giovanni.piemontese Technical Lead @ Lรถffelhardt Spryker Solution Partner Posts: 871 ๐ง๐ปโ๐ - Cadet
Why u want update an order entity in this form? Can u please explain what is your goal?
0 -
I dont see why not
0 -
scrambling email and deleting all other user related data, just as CustomerFacade::anonymizeCustomer does
0 -
but I've already figured out how to do that
0 -
Thereโs always some project with some expectations. I think that updateOrder is just not aimed to cover such cases
0 -
you could create your own
scrambleUserData($orderId)
that internally is passing by the existing OrderFacadeโs capabilities0 -
Ah ok, so already figured out a way. Which way did you chose? ๐
0 -
giovanni.piemontese Technical Lead @ Lรถffelhardt Spryker Solution Partner Posts: 871 ๐ง๐ปโ๐ - Cadet
I thing that the clean way is this to manage via oms. When u want to do it?
0 -
pulled orders from a query and updated entities, like a caveman ๐
0 -
giovanni.piemontese Technical Lead @ Lรถffelhardt Spryker Solution Partner Posts: 871 ๐ง๐ปโ๐ - Cadet
Oh no please. Why not update the customer data fields with a command by order in oms state machine?
0 -
sue me
0 -
๐
0 -
giovanni.piemontese Technical Lead @ Lรถffelhardt Spryker Solution Partner Posts: 871 ๐ง๐ปโ๐ - Cadet
There u have the whole order entity and u have just to run your business logic and stop.
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K ๐ Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random