Skip to content

Deactivate ItemNormalizer when not in ApiPlatform context#2006

Closed
joelwurtz wants to merge 1 commit into
api-platform:masterfrom
joelwurtz:patch-1
Closed

Deactivate ItemNormalizer when not in ApiPlatform context#2006
joelwurtz wants to merge 1 commit into
api-platform:masterfrom
joelwurtz:patch-1

Conversation

@joelwurtz

Copy link
Copy Markdown
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

dunglas commented Jun 9, 2018

Copy link
Copy Markdown
Member

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

lyrixx commented Nov 30, 2018

Copy link
Copy Markdown
Contributor

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

soyuka commented Feb 15, 2019

Copy link
Copy Markdown
Member

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