Repository/FormRepository.php
public function loadById($id, $locale = null)
    {
        $queryBuilder = $this->createQueryBuilder('form')
            ->leftJoin('form.translations', 'translation')->addSelect('translation')
            ->leftJoin('form.fields', 'field')->addSelect('field')
            ->leftJoin('field.translations', 'fieldTranslation')->addSelect('fieldTranslation')
            ->leftJoin('translation.receivers', 'receiver')->addSelect('receiver');

        $queryBuilder->where($queryBuilder->expr()->eq('form.id', ':id'));
        $queryBuilder->setParameter('id', $id);
        $queryBuilder->orderBy('field.order');
        $query = $queryBuilder->getQuery();

        try {
            return $query->getSingleResult();
        } catch (NoResultException $e) {
            return null;
        }
    }
public function loadById($id, $locale = null)
    {
        $queryBuilder = $this->createQueryBuilder('form')
            ->leftJoin('form.translations', 'translation')->addSelect('translation')
            ->leftJoin('form.fields', 'field')->addSelect('field')
            ->leftJoin('field.translations', 'fieldTranslation')->addSelect('fieldTranslation')
            ->leftJoin('translation.receivers', 'receiver')->addSelect('receiver');

        $queryBuilder->where($queryBuilder->expr()->eq('form.id', ':id'));
        $queryBuilder->setParameter('id', $id);
        $queryBuilder->orderBy('field.order');
        $query = $queryBuilder->getQuery();

        try {
            return $query->getSingleResult();
        } catch (NoResultException $e) {
            return null;
        }
    }
@param int $id
@param string $locale

@return Form|null