vendor/theatre/core/src/Repository/TypesstructuresRepository.php line 72

Open in your IDE?
  1. <?php
  2. namespace TheatreCore\Repository;
  3. use TheatreCore\Entity\Typesstructures;
  4. use TheatreCore\Traits\TheatreTrait;
  5. use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
  6. use Doctrine\Persistence\ManagerRegistry;
  7. /**
  8.  * TypesstructuresRepository
  9.  *
  10.  * This class was generated by the Doctrine ORM. Add your own custom
  11.  * repository methods below.
  12.  */
  13. class TypesstructuresRepository extends ServiceEntityRepository
  14. {
  15.     use TheatreTrait;
  16.     private $em;
  17.     public $__table;
  18.     public $__table_object;
  19.     public $__idtable;
  20.     public function __construct(ManagerRegistry $registry)
  21.     {
  22.         parent::__construct($registryTypesstructures::class);
  23.         $this->__table $this->getClassMetadata()->getTableName();
  24.         $this->__table_object $this->getClassMetadata()->name;
  25.         $this->__idtable $this->getClassMetadata()->getSingleIdentifierFieldName();
  26.     }
  27.     //  {{{ getTypeStructureList()
  28.     /** Récupére la liste des types de structures
  29.      *
  30.      * Récupére tous les types de structures pour les listes
  31.      * déroulantes par exemple
  32.      *
  33.      * @access   public
  34.      * @return   array
  35.      */
  36.     public function getTypeStructureList($public_view null$pluriel false$choix_type = array(), $namesOnly false)
  37.     {
  38.         if ($namesOnly) {
  39.             $sql 'SELECT DISTINCT typestructure, idtypestructure';
  40.         } else {
  41.             $sql 'SELECT DISTINCT idtypestructure, typestructure';
  42.         }
  43.         if ($pluriel) {
  44.             $sql .= ',typestructure_pluriel';
  45.         }
  46.         $sql .= ' FROM ' $this->__table ' WHERE 1 ';
  47.         if (!empty($public_view)) {
  48.             $sql .= ' AND public_view=1 ';
  49.         }
  50.         if (!empty($choix_type) && is_array($choix_type)) {
  51.             foreach ($choix_type as $k => $c) {
  52.                 $choix_type[$k] = '\'' $c '\'';
  53.             }
  54.             $sql .= ' AND idtypestructure IN (' join(','$choix_type) . ') ';
  55.         }
  56.         $sql .= ' ORDER BY order_view, typestructure';
  57.         if ($pluriel) {
  58.             $typestructure_list $this->getEntityManager()->getConnection()->fetchAllAssociativeIndexed($sql);
  59.         } else {
  60.             $typestructure_list $this->getEntityManager()->getConnection()->fetchFirstColumn($sql);
  61.         }
  62.         return $typestructure_list;
  63.     }
  64.     // }}}
  65.     //  {{{ getTypeStructure()
  66.     /** Récupérer un type de structure
  67.      *
  68.      * @access   public
  69.      * @return   array
  70.      */
  71.     public function getInfosTypeStructure($idtypestructure)
  72.     {
  73.         return $this->get($idtypestructure);
  74.     }
  75.     // }}}
  76. }