vendor/stimactiv/core-bundle/src/Repository/LangRepository.php line 18

Open in your IDE?
  1. <?php
  2. namespace Stimactiv\CoreBundle\Repository;
  3. use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
  4. use Doctrine\ORM\Query\ResultSetMapping;
  5. use Doctrine\Persistence\ManagerRegistry;
  6. use Stimactiv\CoreBundle\Entity\Lang;
  7. /**
  8.  * @method Lang|null find($id, $lockMode = null, $lockVersion = null)
  9.  * @method Lang|null findOneBy(array $criteria, array $orderBy = null)
  10.  * @method Lang[]    findAll()
  11.  * @method Lang[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  12.  */
  13. class LangRepository extends ServiceEntityRepository
  14. {
  15.     public function __construct(ManagerRegistry $registry)
  16.     {
  17.         parent::__construct($registryLang::class);
  18.     }
  19.     public function table(): array
  20.     {
  21.         $l Lang::$_dbAlias;
  22.         $sql "SELECT {$l}.*
  23.                      , '%route_edit%' route_edit
  24.                 FROM lang {$l}
  25.                 ORDER BY {$l}.position ASC";
  26.         $rsm = new ResultSetMapping();
  27.         $rsm->addScalarResult('lang_id''id''integer');
  28.         $rsm->addScalarResult('title''title');
  29.         $rsm->addScalarResult('code''code');
  30.         $rsm->addScalarResult('locale''locale');
  31.         $rsm->addScalarResult('datetime_format''datetimeFormat');
  32.         $rsm->addScalarResult('decimal_separator''decimalSeparator');
  33.         $rsm->addScalarResult('thousands_separator''thousandsSeparator');
  34.         $rsm->addScalarResult('active''active''boolean');
  35.         $rsm->addScalarResult('visible''visible''boolean');
  36.         $rsm->addScalarResult('decimals''decimals''integer');
  37.         $rsm->addScalarResult('by_default''byDefault''boolean');
  38.         $rsm->addScalarResult('position''position''integer');
  39.         $rsm->addScalarResult('route_edit''routeEdit');
  40.         $query $this->_em->createNativeQuery($sql,$rsm);
  41.         return $query->getArrayResult();
  42.     }
  43. }