<?php
namespace Stimactiv\CoreBundle\Repository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\Persistence\ManagerRegistry;
use Stimactiv\CoreBundle\Entity\Lang;
/**
* @method Lang|null find($id, $lockMode = null, $lockVersion = null)
* @method Lang|null findOneBy(array $criteria, array $orderBy = null)
* @method Lang[] findAll()
* @method Lang[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class LangRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Lang::class);
}
public function table(): array
{
$l = Lang::$_dbAlias;
$sql = "SELECT {$l}.*
, '%route_edit%' route_edit
FROM lang {$l}
ORDER BY {$l}.position ASC";
$rsm = new ResultSetMapping();
$rsm->addScalarResult('lang_id', 'id', 'integer');
$rsm->addScalarResult('title', 'title');
$rsm->addScalarResult('code', 'code');
$rsm->addScalarResult('locale', 'locale');
$rsm->addScalarResult('datetime_format', 'datetimeFormat');
$rsm->addScalarResult('decimal_separator', 'decimalSeparator');
$rsm->addScalarResult('thousands_separator', 'thousandsSeparator');
$rsm->addScalarResult('active', 'active', 'boolean');
$rsm->addScalarResult('visible', 'visible', 'boolean');
$rsm->addScalarResult('decimals', 'decimals', 'integer');
$rsm->addScalarResult('by_default', 'byDefault', 'boolean');
$rsm->addScalarResult('position', 'position', 'integer');
$rsm->addScalarResult('route_edit', 'routeEdit');
$query = $this->_em->createNativeQuery($sql,$rsm);
return $query->getArrayResult();
}
}