serializer
serializer copied to clipboard
example for https://jmsyst.com/libs/serializer/master/cookbook/object_constructor
I try to setup doctrine object to populate without success. please help
https://stackoverflow.com/questions/68454962/jms-serializer-object-to-populate/69555946#69555946
This isn't working for me either.
$context = new DeserializationContext();
$xmlImport = file_get_contents($input->getOption('path') . '/import.xml');
$configImport = $this->serializer->deserialize($xmlImport, XmlBase::class, 'xml');
$context->setAttribute('target', $configImport);
$xmlCandidate = file_get_contents($input->getOption('path') . '/candidate.xml');
$configCandidate = $this->serializer->deserialize($xmlCandidate, XmlBase::class, 'xml', $context);
dd($configCandidate);
XmlBase is the parent and contains a nested child XmlSystem.
I get this error message:
Typed property App\Entity\XmlBase::$system must be an instance of App\Entity\XmlSystem, App\Entity\XmlBase used