I'm trying to sort an array of objects by name in Symfony. But I don't know how to do that, because the strings start with numbers so the order is not good.
I tried with a queryBuilder in my repository:
$qb = $this->createQueryBuilder('arrondissement')
->addOrderBy('arrondissement.nom', 'ASC');
$query = $qb->getQuery();
return $query->execute();
And a sort() function in the controller,
But as you can see it's not totaly that. I wnat something like : 1er arrondissement, 2e ...., 20e..., Paris