public function findTranslation(Block $block, $locale) { $source = null; // We are checking if the node is the translation provider or translated // from an other node if ($block->getTranslationSource() !== null) { $source = $block->getTranslationSource(); if ($source->getLocale() == $locale) { return $source; } } else { $source = $block; } return $this->createQueryBuilder('n')->addSelect('n')->andWhere('n.translationSource = :source')->andWhere('n.locale = :locale')->setParameters(['source' => $source, 'locale' => $locale])->getQuery()->getOneOrNullResult(); }