I retrieve all objects for an entity like this:
$allQuestions = $em->getRepository('AppMyBundle:Question')
->findBy(array('isActive' => true, 'isDeleted' => false));
I get an array of objects into $allQuestions
. Is there a possibility to get an ArrayCollection
instead of an array?
You could just do
$collection = new ArrayCollection($allQuestions);
To convert the array to an ArrayCollection.
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