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.
Asked
Active
Viewed 1.1k times
2 Answers
18
If I understand your question correctly, this helps you:
$arrayValues = $persistentCollection->getValues();

Evgeny Ruban
- 1,357
- 1
- 14
- 20
3
$yourCollection->unwrap()->toArray();
That should give you the content of your collection as an array()

Yoann MIR
- 811
- 5
- 17