Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example for https://jmsyst.com/libs/serializer/master/cookbook/object_constructor #1352

Open
grekpg opened this issue Oct 13, 2021 · 1 comment

Comments

@grekpg
Copy link

grekpg commented Oct 13, 2021

I try to setup doctrine object to populate without success. please help

https://stackoverflow.com/questions/68454962/jms-serializer-object-to-populate/69555946#69555946

@rcmcdonald91
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants