S
S
symnoob2020-01-11 16:59:28
symfony
symnoob, 2020-01-11 16:59:28

How to use Jms Serializer with Doctrine with Lazy setup?

Hello everyone, maybe someone came across, I'm trying to use jms Serializer, but since the data comes from the doctrine and the lazy anatomy is registered in the entity, the object is serialized empty ...
Is there any simple way to solve the problem?
Thank you all in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2020-01-11
@symnoob

@Accessor annotation

/** @Accessor(getter="getName") */
private $name;

public function getName()
{
     return $this->name;
}

In general, if you write from scratch, then you should know that everyone is moving away from JMS Serializer towards Symfony Serializer
. You should already have a service in the container @serializerimmediately after installing the component and you can simply inject it through SerializerInterfacein the constructor

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question