Sample User repository method that return all user names in an array:
/**
* Find user names
*
* @return array
*/
public function findAllNames()
{
$names = $this->createQueryBuilder('u')
->select('DISTINCT(u.name)')
->getQuery()
->getResult('simple_list_hydrator');
return $names;
}
Will return:
array("Moony", "Wormtail", "Padfoot", "Prongs");