Calling Developers!
We are reenergizing our code contribution process! Learn More

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, has anybody been working with strict transfers extensively? We are facing an issue when defining

Options
UKMHZV8LX
UKMHZV8LX Posts: 69 🧑🏻‍🚀 - Cadet

Hi, has anybody been working with strict transfers extensively? We are facing an issue when defining a strict transfer, that contains another transfer.

Consider this example:

<transfer name="Foo" strict="true">
    <property name="bar" type="Bar">
</transfer>

<transfer name="Bar" strict="true">

</transfer>

It will create a transfer Foo containing a property bar, that can be of type Bar|null. This is as expected.

However Foo::fromArray will do Foo::assertInstanceOfTransfer on property bar, which will throw an exception, if bar is null. This is not expected.

Does somebody know, whether there is a bug or we use this feature in a wrong way?

Thanks in advance.

Comments

  • Please always mention the version you are running the module with.
    Is that latest module Transfer version?

  • UKMHZV8LX
    UKMHZV8LX Posts: 69 🧑🏻‍🚀 - Cadet
    Options

    It’s 3.29.2

  • That issue sounds familiar.
    Let me check if we are close to releasing this fix.

    The $value !== null part is missing in the check

    if ($value !== null && $this->isPropertyStrict($normalizedPropertyName)) {
        $this->assertInstanceOfTransfer($normalizedPropertyName, $value);
    }
    

    per transfer.

    I can let you know what I find out.
    In the meantime you could adjust the template accordingly and continue.

  • UKMHZV8LX
    UKMHZV8LX Posts: 69 🧑🏻‍🚀 - Cadet
    Options

    Thanks

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice
    Options

    May I close the support request if it's clarified then? Or not yet?

  • I will try to push this fix to be available before NYE.
    I cannot say if we should close or keep open until then.

  • UKMHZV8LX
    UKMHZV8LX Posts: 69 🧑🏻‍🚀 - Cadet
    Options

    I would like to keep the case open until a fix is available. Thanks for following up on this.

  • Good news, the fix has been released now as https://github.com/spryker/transfer/releases/tag/3.30.2

  • @UKMHZV8LX Did this fix your issues?
    Can we then close this topic?

  • UKMHZV8LX
    UKMHZV8LX Posts: 69 🧑🏻‍🚀 - Cadet
    Options

    Oh well, I did not notice, that a fix is in place as I did not receive a reply from the service desk.

  • I am sure it is coming, but I wanted to give you a heads up beforehand. Just to make sure we covered all points.

  • UKMHZV8LX
    UKMHZV8LX Posts: 69 🧑🏻‍🚀 - Cadet
    Options

    I will need some time to really run the implementation, but from looking at the code it looks fine.