我遵循了https://github.com/beberlei/DoctrineExtensions所示的步骤 但是当我尝试使用GroupConcat时,它将返回:
Symfony\Component\Debug\Exception\ClassNotFoundException:
Attempted to load class "GroupConcat" from namespace "DoctrineExtensions\Query\Mysql".
Did you forget a "use" statement for another namespace?
at vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php:3529
at Doctrine\ORM\Query\Parser->CustomFunctionsReturningStrings()
(vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php:3402)
doctrine:
orm:
dql:
string_functions:
group_concat: DoctrineExtensions\Query\Mysql\GroupConcat
$qb = $this->createQueryBuilder('u');
$qb = $qb->select("c.code, c.description, count(u) as total, GROUP_CONCAT(DISTINCT u.id SEPARATOR ', ') AS ids");
use DoctrineExtensions\Query\Mysql\GroupConcat;