What is best way (easy) to convert Doctrine 2 entity persistent collection to array with Zend Framework 2? I want convert to array and later output it with JsonView. I can write function which use get_object_var but it is a problem when entity has next entity collection.
Regards.
Not sure about Zend, but in SF2 + Doctrine you can use getValues()
method.
$asArray = $persistentCollection->getValues();