检查 select 计数值是否为 null/empty query builder symfony

check if select count value is null/empty query builder symfony

我的查询构建器如下所示

 $qb
            ->select([
                'c.id as c_id',
                'c.name as c_name',
                sprintf('(SELECT COUNT(t) FROM %s t WHERE t.example = c.example) as t_total',
                    t::class),
                sprintf('(SELECT COUNT(z) FROM %s z WHERE z.example = c.secondExample) as z_total',
                    z::class),
            ])
            ->from(c:class, 'c')
            ->getQuery()->getResult();

有什么方法可以检查 t_total 和 z_total 是否为空?我不想仅在 t_total AND z_total 为 null/empty

时才显示此行

如@mickmackusa 所说

$qb->having('z_total IS NOT NULL OR t_total IN NOT NULL');

按照我想要的方式工作