我想用 Doctrine 计算子选择返回的行数。我的子选择是:
SELECT e FROM \comments\Entities\Event e
WHERE e.type = 'addComment'
HAVING TIMESTAMPDIFF(MINUTE, e.commentedOnPublished, e.created) < 60)
在 SQL 中,我将通过以下方式实现预期的结果:
SELECT COUNT(*) FROM (
SELECT e.* FROM square_events as e
WHERE e.type = 'addComment'
HAVING TIMESTAMPDIFF(minute, e.commentedOnPublished, e.created) < 60
) temp
有谁知道如何用 Doctrine 实现这一点?