Problem/Motivation
/**
* Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize().
*/
public function normalize($object, $format = NULL, array $context = array()) {
$attributes = array();
foreach ($object as $name => $field) {
$attributes[$name] = $this->serializer->normalize($field, $format);
}
return $attributes;
}
The child items that are iterated over do not get the context passed in. I would guess this is an artefact of just a missed parameter when the serializer component was updated to pass a $context parameter.
Proposed resolution
Add $context to the normalize() calls for each field.
Remaining tasks
Tests, Add the variablle, done
User interface changes
None
API changes
None
Data model changes
None
Beta phase evaluation
Comments
Comment #2
damiankloip commentedComment #3
damiankloip commentedComment #6
dawehnerWhy is $context not always a required parameter? Odd world
Let's just go with @covers ::supportsNormalization and skip the human words
Do we really want to check the order of the execution of the serialization? Seems to limit our implementation a bit.
Ah great, pass in two values, this is not a bad idea to test.
Comment #7
damiankloip commented1. Yeah.. I think because it was introduced and needed BC
2. Yeah! c&p fail
3. Not sure what you mean, I would think we would like to know that each item is passed in? We know what the items will be from the TestComplexData class
4. KISS
Comment #8
damiankloip commentedWith prophecy.
Comment #9
damiankloip commentedUgh, and with the @covers
Comment #10
dawehnerNot needed anymore
Can we use Serializer::class ? its way nicer
Comment #11
damiankloip commentedThanks!
Comment #12
dawehnerThank you!
Comment #13
alexpottCommitted 7461ba2 and pushed to 8.0.x. Thanks!