Doctrine 2 - How to use discriminator column in where clause
It would look in query builder like this:
$class = 'Entity\File\Image';
$qb = $this->createQueryBuilder('f');
$qb->where($qb->expr()->isInstanceOf('f', $class));
Note: that you will not be able to set the class as a parameter because it will be escaped.
I think that you should use INSTANCE OF
for PHP 5.50 and above:
$this->createQueryBuilder('f')
->andWhere('f INSTANCE OF '.Image::class)