Fixing incorrect usage of the Doctrine ODM query builder

Code must have been copied over from the the Doctrine ORM, as it was using that style. I've corrected this for ODM templates.