Count Rows in Doctrine QueryBuilder

Something like: $qb = $entityManager->createQueryBuilder(); $qb->select(‘count(account.id)’); $qb->from(‘ZaysoCoreBundle:Account’,’account’); $count = $qb->getQuery()->getSingleScalarResult(); Some folks feel that expressions are somehow better than just using straight DQL. One even went so far as to edit a four year old answer. I rolled his edit back. Go figure.

Should everything really be a bundle in Symfony 2.x?

I’ve written a more thorough and updated blog post on this topic: http://elnur.pro/symfony-without-bundles/ No, not everything has to be in a bundle. You could have a structure like this: src/Vendor/Model — for models, src/Vendor/Controller — for controllers, src/Vendor/Service — for services, src/Vendor/Bundle — for bundles, like src/Vendor/Bundle/AppBundle, etc. This way, you would put in the … Read more