-
-
Notifications
You must be signed in to change notification settings - Fork 934
fix(serializer): propertyFilter should apply to arrays as well #5444
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
Conversation
tests/Fixtures/TestBundle/Entity/DummyWithArrayOfNotResourceObject.php
Outdated
Show resolved
Hide resolved
fb3eddb
to
6aae5b9
Compare
6aae5b9
to
f071bcb
Compare
|
||
if ($type && $type->getBuiltinType() === 'array') { | ||
$childContext = $this->createChildContext($context, $attribute, $format); | ||
unset($childContext['iri'], $childContext['uri_variables']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: check if we shouldn't remove operation
also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you explain me what choices lead to unset()
these contexts?
because we're serializing "non api resource" objects, there would be no need to have the operation available in the context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it'll re-use the old operation if any when creating an IRI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unless I'm misunderstanding something, no IRI should be generated, since we're dealing with non-apiresource objects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes they have Skolem IRIs unless disabled by using the genId: false
attribute.
f071bcb
to
c845ea3
Compare
fix(PropertyFilter): should apply to arrays as well
c845ea3
to
20210d1
Compare
🎉 |
…latform#5444) fix(PropertyFilter): should apply to arrays as well
This MR broke our code in unexpected ways, we now receive "Unable to generate an IRI for the item of type X" in our unit tests. |
PropertyFilter
does not presently work with arrays of objects which are notApiResource
: it just always serializes these objects as null arrays.FYI I've tested with
ArrayCollection
of objects which are notApiResource
and it works like a charm