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

I have a question about potential limit of the spryker transfer objects. Let's say we sometimes have

UK5DS29L2
UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

I have a question about potential limit of the spryker transfer objects.
Let's say we sometimes have products with sizeOptions and sometimes with colorOptions (and sometimes with other options) depending on what is a super attribute in the product.
How to approach defining this in the transfer object if it pretty much relies on what was configured in the admin/database and not the code?

Comments

  • UQ958DA4U
    UQ958DA4U Posts: 232 πŸ§‘πŸ»β€πŸš€ - Cadet

    This sounds like a reason for multiple disparate types. If that is not possible, just create nullable fields in your DTOs and verify on the consuming side which one is which. But really, this should go into separate types if possible.

  • Stanislav Matveyev
    Stanislav Matveyev Sprykee Posts: 211 πŸ§‘πŸ»β€πŸš€ - Cadet

    All proprties of Spryker transfers are nullable.
    Also, it is supposed to use transfer objects without any limitation.
    You are not required to fill in all the fields with values, you can use it as you wish: one property with value and all other nulls, or only few properties could have a value and all other nulls.

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited February 2020

    but that means I have to add them to the code every time some admin adds/clicks it in the admin panel which is not what I'm doing daily. that's the main isue here - inconsistency

  • Stanislav Matveyev
    Stanislav Matveyev Sprykee Posts: 211 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited February 2020

    Is it possible ot add two property to you transfer? like
    optionType="color|size|…" and options=OptionTransfer[]

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    that won't work. sometimes product have both color and size as super attributes

  • UK5DS29L2
    UK5DS29L2 Posts: 546 πŸ§‘πŸ»β€πŸš€ - Cadet

    so you cannot pick only one and add it to property