What is best way to convert Doctrine entity persistent collection to array with symfony 2 ? I want to get the values and later by using that array value, need to get the second entity values which dependent on first entity using form event listener.
If I understand your question correctly, this helps you:
$arrayValues = $persistentCollection->getValues();
$yourCollection->unwrap()->toArray();
That should give you the content of your collection as an array()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With