Open fjugaldev opened 4 years ago
If you are using, SerializerBuilder::create(), you are completely bypassing all the symfony handling and getting a plain serializer. You should use the symfony dependency injection and get the instance from there.
Hi @goetas thank your answer so what i need to do is take advance of the autowiring and set as parameter of the method.
I tried too access to the serializer via the container service but i notice that it’s no anymore declared as a service.. I can define too in the services.yml? If is possible will work just like the autowiring dependencies?
Thank you bro for helping me..
Regards!!
Francisco
autowiring should do the job. If you typehing your controller/service with Jms\Serialier\SerializerInterface
, DI should do the Job for you.
Hi guys..
I'm trying to add some excluding groups and i can't make work this configuration.
I'm using symfony 5 and this is my config:
My Model is in
InnovatikLabs\Shared\Domain\Model\Address
and the mapping is made using xml.When i execute a doctrine find in my controller i get an Address object and when i return a JsonResponse like this:
The response is empty.
I think i'm missing something or i guess the bundle is no reading my config in order to get the excluding groups from the yaml's.
Note: If i use the method addMetadataDir like this:
And renaming the .yml containing the serialization groups, in order to include all the namespace like
InnovatikLabs.Shared.Domain.Model.Address.yml
, it works! but i need an automated way to declare all my config and serialization groups and only stay focus in serializa and deserialize objects.Can anybody help me please xD