<?php
namespace App\Repository;
use App\Entity\CustomTranslation;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method CustomTranslation|null find($id, $lockMode = null, $lockVersion = null)
* @method CustomTranslation|null findOneBy(array $criteria, array $orderBy = null)
* @method CustomTranslation[] findAll()
* @method CustomTranslation[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class CustomTranslationRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, CustomTranslation::class);
}
public function findByLocale($locale): array
{
return $this->createQueryBuilder('c')
->select(['c.id', 'c.name', 'c.value'])
->andWhere('c.locale = :locale')
->setParameter('locale', $locale)
->getQuery()
->getArrayResult()
;
}
}