Q
Q
Quber2014-10-06 10:09:42
symfony
Quber, 2014-10-06 10:09:42

How to serialize an entity in Symfony 2?

There is an entity Countries and Regions.
There is a connected bundle JMSSerializerBundle.
There is a link OneToMany Countries to Regions.
When I extract all countries $data = $em->findAll() and then try to execute $serializer->serialize($data, 'json') then serialization occurs not only for countries but also for all regions tied to them. But I do not need serialization of regions, as performance starts to sag. How to serialize an entity without relationships to other tables?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2014-10-06
@Quber

You need to configure Exclusion Strategies:
jmsyst.com/libs/serializer/master/cookbook/exclusi...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question