Skip to content

fix #2158 - denormalize items without context and no Iri #2399

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

Closed
wants to merge 1 commit into from

Conversation

rpanfili
Copy link

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #2158
License MIT
Doc PR -

This PR fix an issue when context does not contain the resource_class key.

It's the same behaviour of the AbstractItemNormalizer that inherit that option from the $class parameter before calling the parent::denormalize method. It actually has to be applied before try to update the object with updateObjectToPopulate method otherwise, if we are not using an IRI @id but only the object identifier, we got an

[ErrorException]
  Notice: Undefined index: resource_class

This is very useful using Symfony Messenger with Api-platform since otherwise Entity normalizer fails to denormalize object and we are not able to consume messages.

@soyuka
Copy link
Member

soyuka commented Dec 20, 2018

Does #2326 fix your issue?

@rpanfili
Copy link
Author

rpanfili commented Dec 20, 2018

Does #2326 fix your issue?

@soyuka in my specific use case (Messenger messages consumption) it works but that solution skips IRI composition (using the "guessed" class) and object population that can happens in updateObjectToPopulate as I tried to reproduce with the unit test case. Also the logger warning (maybe better a notice instead) it's a bit too much in my opinion since it's something that the parent class would normally manage without triggering any message.

@dunglas
Copy link
Member

dunglas commented Dec 20, 2018

Thanks for contributing @rpanfili! We finally merged #2326 that fixes the same issue.

@dunglas dunglas closed this Dec 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants