I want to count rows returned by subselect with Doctrine. The subselect I have is:
SELECT e FROM \comments\Entities\Event e
WHERE e.type = 'addComment'
HAVING TIMESTAMPDIFF(MINUTE, e.commentedOnPublished, e.created) < 60)
In SQL I’d achieve the desired result with:
SELECT COUNT(*) FROM (
SELECT e.* FROM square_events as e
WHERE e.type = 'addComment'
HAVING TIMESTAMPDIFF(minute, e.commentedOnPublished, e.created) < 60
) temp
Does anyone know how this could be achieved with Doctrine?
I’m sure I’d already tried this and a thousand other solutions, anyway this is what I ended up with after one of our systems guys pointed out I was being an idiot!
One of those days…