The getResult()
always returns an array. If you want a collection, you must pass the array that is returned by getResult()
to Doctrine’s ArrayCollection
e.g.
use Doctrine\Common\Collections\ArrayCollection;
$result = $this
->getEntityManager()
->createQueryBuilder()
->select('p')
->from('...\Player', 'p')
->getQuery()
->getResult()
;
$players = new ArrayCollection($result);