Skip to content

Deactivate ItemNormalizer when not in ApiPlatform context #2006

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

joelwurtz
Copy link
Contributor

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

We use the serializer to save / load some json encoded data into our database, so we do something like this :

$this->serializer->deserialize($encoded, MyObject::class . '[]', 'json');

However we recently added some validation on this object and use api platform to do it, so we needed to add a fake id parameter (not sure if it's still useful ?)

When doing this previous code was not working because when using this serializer it's trying to use the iri convertion tool which is really not need in our case.

Not sure if this is the right fix but for us it works.

@dunglas
Copy link
Member

dunglas commented Jun 9, 2018

I'm not sure to get the use case/problem, but I don't see how it may hurt to add this test, so 👍 on my side. But can you add a non-regression test to highlight the use case, and prevent that someone remove this check at some point?

ping @api-platform/core-team

@lyrixx
Copy link
Contributor

lyrixx commented Nov 30, 2018

Ahaha, I work with @joelwurtz on the same project, and it looks like I had the same issue. But I totally missed this PR, that's why I created #2326

@soyuka
Copy link
Member

soyuka commented Feb 15, 2019

We merged #2326 so I guess this can be closed. Also #2495 should improve the normalization of non-resources.

@soyuka soyuka closed this Feb 15, 2019
@joelwurtz joelwurtz deleted the patch-1 branch February 15, 2019 15:15
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.

4 participants