fix(serializer): collection denormalization from object linked to doctrine entities#4301
fix(serializer): collection denormalization from object linked to doctrine entities#4301nicodmf wants to merge 1 commit into
Conversation
|
Why don't you send IRI's for json format? |
|
to be consistent with response which give not an iri but an numeric id. I just try with iri, same result |
|
i just see #2326, this fix isn't aware for all cases, neither last PR... The logger don't work too and provide a NullLogger. So, what do you think about a fix working in all cases ? |
|
I need to understand the use case behind it, not sure this is expected behavior |
|
@soyuka The use case is the send of many objects which should be received together because each change on the system has important cost. Send objects together permit to validate all changes and to transmit computional operations in one pass. The object to deserialize looks like {
rules: [
{id: '', period: xx, type: "", values: [ {id, value, populationTarget} ] },
{id: '', period: xx, type: "", values: [ {id, value, populationTarget} ] }
]
}I found a workarround with a dedicated resource and messager=true. But actually, it remains the logger bug which is a NullLogger. |
|
mb related #1645 |
As it, denormalization doesn't find the children class in this case :
If $entity has an id like in the example, object is denormalized normally with json ld (
"@id": "iri"). With json format, the resource_class is absent from context and the object is denormalized without database populate and losing the id value. This fix come from parent class https://github.com/api-platform/core/blob/2.6/src/Serializer/AbstractItemNormalizer.php#L187 which will be call after the populate.