Doctrine2, PersistentCollection and JMS Serializer
问题 I have an Entity with a oneToMany relationship, I can get the associated items using; $this->getQueuedItems() This returns Doctrine\ORM\PersistentCollection object, I am then passing this to JMS Serializer like so; $serializer = $container->get('serializer'); $json = $serializer->serialize($this->getQueuedItems(), 'json'); But outputting $json using var_dump() results in; string(2) "[]" Which is wrong. There is data there, because if I do a foreach() over $this->getQueuedItems() I get data.