[Solved] Convert sql to dql symfony [closed]


I assume that you’re within the context of a repository, so in which case I’d advise using the Doctrine Query Builder, it’d help simplify your code flow, and probably would help you with SQL conversions in the future.

To answer this specific problem, you’d probably want to do something like the following:

public function findSaveByPagesByFilters()
{
    return $this->createQueryBuilder('p')
        ->innerJoin('p.files', 'f', Query\Expr\Join::ON, 'p.id = f.pallets')
        ->select(['*', 'count(p.id)'])
        ->groupBy('f.p')
        ->orderBy('f.name', 'DESC')
        ->getQuery()
        ->getResult();
}

2

solved Convert sql to dql symfony [closed]