xmlFoo : $this->foo; } public function denormalize(SerializerInterface $serializer, $data, $format = null) { if ($format === 'xml') { $this->xmlFoo = $data; } else { $this->foo = $data; } } }