Is is possible in Symfony Serializer
to deserialize an array of objects in a property? I have a Boss
class with the $Npc = []
property that needs to hold a array of Npc
objects. I did see some examples in the documentation, but they do not state this feature. I have a json string with an array of NPC's For example:
class Boss {
private $Npc = [];
/**
* @return Npc[]
*/
public function getNpcs(): array
{
return $this->npcs;
}
}
I am using php7.1 and symfony/serializer version ^3.3.
Edit: I already tried PhpDocExtractor, but it would not let me install it. :(
Edit: This is a possible JSON value:
{
"bossname": "Epic boss!",
"npcs": [{
"id": 24723,
"name": "Selin Fireheart",
"urlSlug": "selin-fireheart",
"creatureDisplayId": 22642
}]
}