Last active
January 25, 2021 20:50
-
-
Save tarlepp/a076b841cc7f405d728b7ac94d8792c1 to your computer and use it in GitHub Desktop.
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 | |
namespace App\Model; | |
class Header | |
{ | |
/** | |
* @var string | |
*/ | |
public $OrganizationID; | |
/** | |
* @var int | |
*/ | |
public $DivisionID; | |
} |
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 | |
namespace App\Controller; | |
use App\Model\ItemMaintenance; | |
use Symfony\Component\HttpFoundation\JsonResponse; | |
use Symfony\Component\Routing\Annotation\Route; | |
use Symfony\Component\Serializer\SerializerInterface; | |
class IndexController | |
{ | |
/** | |
* @Route(path="/") | |
*/ | |
public function __invoke(SerializerInterface $serializer): JsonResponse | |
{ | |
$xml = <<<XML | |
<ItemMaintenance> | |
<Header> | |
<OrganizationID>Test</OrganizationID> | |
<DivisionID>41</DivisionID> | |
</Header> | |
</ItemMaintenance> | |
XML; | |
$data = $serializer->deserialize($xml, ItemMaintenance::class, 'xml'); | |
dd($data); | |
return new JsonResponse($data); | |
} | |
} |
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 | |
namespace App\Model; | |
class ItemMaintenance | |
{ | |
public $Version; | |
/** | |
* @var Header | |
*/ | |
public $Header; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment