Can be found by returning arraycollection instead of array
I am fetching all objects for an entity like this:
$allQuestions = $em->getRepository('AppMyBundle:Question')
->findBy(array('isActive' => true, 'isDeleted' => false));
I am getting an array of objects in $allQuestions
. Is there a way to get ArrayCollection
instead of an array?
+3
smartcoderx
source
to share
1 answer
You could just do
$collection = new ArrayCollection($allQuestions);
To convert an array to an ArrayCollection.
+3
vdwijngaert
source
to share