我有这个错误:
“注意:未定义的偏移量:C:\wamp\www\Videotheque\vendor\doctrine\lib\Doctrine\ORM\QueryBuilder.php 第 240 行中的 0”
我正在在线创建视频集。有 2 个实体:电影和流派。在我的 GenRerepository 方法中,我尝试将函数 findAll() 重新定义为与类型相关的电影数量。
这是功能:
public function myFindAll()
{
    $genres = $this->_em->createQueryBuilder('g')
                        // leftJoin because I need all the genre
                        ->leftJoin('g.films', 'f')
                        ->addSelect('COUNT(f)')
                        ->groupBy('g')
                        ->getQuery()
                        ->getArrayResult();
    // $genres contains all the genres and the associated movies
    return ($genres);
}