Last active
November 17, 2020 13:41
-
-
Save merltron-pa/cfe565aba5b47f9b6771f676f017743b to your computer and use it in GitHub Desktop.
PHP/JMS Article: Serialize test data into XML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
class TestAddressController extends AbstractController | |
{ | |
/** | |
* @Route("/test/address", methods={"POST"}) | |
*/ | |
public function postAddress(Request $request): Response | |
{ | |
$a = $this->serializer->deserialize($request->getContent(), Address::class, 'json'); | |
return new Response($this->serializer->serialize($a, 'xml')); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment