你个2018年的项目要进行升级。由Symfony4.1升级到4.4, 升级过程解决了内存报错后,又出现以下错误. Google出是DoctrineMigrationsBundle由2.x升级到3.x引起的,需要修改/config/doctrine_migrations.yml 修改之前: 修改之后: 修改完成后, 运行 更新顺利完成 参考: https://github.com/doctrine/DoctrineMigrationsBundle/issues/338 https://github.com/doctrine/DoctrineMigrationsBundle/blob/master/UPGRADE.md
Category: Doctine
doctrine createQueryBuilder count and not exists
$qb = $this->o->createQueryBuilder(‘o’); $sub = $this->em->createQueryBuilder(); $sub->select(“o.id”); //notice this : cause e.offer is foreign key of o.id $sub->from(ExcludedByOffer::class, “e”); $sub->andWhere(‘e.offer = o.id’) ->andWhere(‘e.aff = :aff’); $qb->select(‘count(o.id)’) ->where(‘o.adv=:adv’) ->andWhere($qb->expr()->not($qb->expr()->exists($sub->getDQL()))) ->setParameters([‘adv’ => $adv, ‘aff’ => $aff ]); return $qb->getQuery()->getSingleScalarResult(); 参考 https://stackoverflow.com/questions/31536137/doctrine-not-exists-subquery/31536545 https://stackoverflow.com/questions/9214471/count-rows-in-doctrine-querybuilder