I want to get only the list of values in the first column of the query.
$types = $em->getRepository('MyBundle:Notice')
->createQueryBuilder('n')
->select('n.type')
->groupBy('n.type')
->getQuery()
->getResult();
exho json_encode($types);
Result
[{"type":"foo"},{"type":"bar"},{"type":"baz"}]
I want to get a result
["foo","bar","baz"]
Of course, I can manually sort out the data and get the result I needed.
foreach ($types as $key => $type) {
$types[$key] = $type['type'];
}
But I want to use the standard method, if any. Unfortunately, I did not find such a method in the documentation. Maybe I'm bad looking)