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..

Hello guys, I wonder what's the easiest way to get an `ItemTransfer` from a `SpySalesOrderItem`. The

U01660GHSTT
U01660GHSTT Posts: 80 πŸ§‘πŸ»β€πŸš€ - Cadet

Hello guys,
I wonder what's the easiest way to get an ItemTransfer from a SpySalesOrderItem. The fromArray / toArray solution doesn't seem to work since the ItemTransfer has many different properties. Or am I using the wrong transfer object for the SpySalesOrderItem?

Comments

  • U01G4K5E0J2
    U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

    question is how did you get item entity (SpySalesOrderItem), if you start from just id, you might want to check sales facade, it probably has some method, that takes item id as argument and returns ItemTransfer

  • Ievgen Varava
    Ievgen Varava Sprykee Posts: 154 πŸ§‘πŸ»β€πŸš€ - Cadet

    exact implementation is there:

    \Spryker\Zed\Sales\Business\Model\Order\OrderHydrator::hydrateOrderItemTransfer()
    
  • U01660GHSTT
    U01660GHSTT Posts: 80 πŸ§‘πŸ»β€πŸš€ - Cadet

    Thank you. I will check this. πŸ‘

  • U01G4K5E0J2
    U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

    it's deprecated

  • Ievgen Varava
    Ievgen Varava Sprykee Posts: 154 πŸ§‘πŸ»β€πŸš€ - Cadet

    I think it's because multi shipping functionality. But item hydration must be the same I guess

  • U01G4K5E0J2
    U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

    that might be true

  • U01660GHSTT
    U01660GHSTT Posts: 80 πŸ§‘πŸ»β€πŸš€ - Cadet

    Ok, I found the hydrate method but nothing in the SalesFacade. I guess I have to add a method for the conversion myself then. Thanks a lot.

  • U01G4K5E0J2
    U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

    well, that's non of my business, but how did you end up with SpySalesOrderItem?

  • U01660GHSTT
    U01660GHSTT Posts: 80 πŸ§‘πŸ»β€πŸš€ - Cadet

    I created a custom module. The facade of this module is used in the OMS and the OMS passes on SpySalesOrderItem[] and SpySalesOrder.
    The Spryker docs say for communication between modules use transfer objects, so I want to refactor it this way.

  • U01G4K5E0J2
    U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

    I see

  • U01G4K5E0J2
    U01G4K5E0J2 Posts: 194 πŸ§‘πŸ»β€πŸš€ - Cadet

    It bugs me how they use Transfers everywhere except OMS plugins