src/Repository/IpaInformeRepository.php line 54

Open in your IDE?
  1. <?php
  2. namespace App\Repository;
  3. use App\Entity\IpaInforme;
  4. use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
  5. use Doctrine\Persistence\ManagerRegistry;
  6. /**
  7.  * @extends ServiceEntityRepository<IpaInforme>
  8.  *
  9.  * @method IpaInforme|null find($id, $lockMode = null, $lockVersion = null)
  10.  * @method IpaInforme|null findOneBy(array $criteria, array $orderBy = null)
  11.  * @method IpaInforme[]    findAll()
  12.  * @method IpaInforme[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  13.  */
  14. class IpaInformeRepository extends ServiceEntityRepository
  15. {
  16.     public function __construct(ManagerRegistry $registry)
  17.     {
  18.         parent::__construct($registryIpaInforme::class);
  19.     }
  20.     public function add(IpaInforme $entitybool $flush false): void
  21.     {
  22.         $this->getEntityManager()->persist($entity);
  23.         if ($flush) {
  24.             $this->getEntityManager()->flush();
  25.         }
  26.     }
  27.     public function remove(IpaInforme $entitybool $flush false): void
  28.     {
  29.         $this->getEntityManager()->remove($entity);
  30.         if ($flush) {
  31.             $this->getEntityManager()->flush();
  32.         }
  33.     }
  34.     /**
  35.      * 
  36.      * @category function
  37.      * 
  38.      * @return array Devuelve un array de resultados
  39.      */
  40.     public function todos(): array
  41.     {
  42.         return $this->createQueryBuilder('p')
  43.                 ->select('p.fecha, p.nivel_del_embalse, p.caudal_vertido, p.caudal_turbinado, p.caudal_de_aportes')
  44.                 ->orderBy('p.fecha''DESC')
  45.                 ->getQuery()
  46.                 ->getResult()
  47.         ;        
  48.     }
  49.     /**
  50.      * 
  51.      * @category function
  52.      * 
  53.      * @return array Devuelve un array de resultados
  54.      */
  55.     public function listExport($limit=365): array
  56.     {
  57.         return $this->createQueryBuilder('p')
  58.                 ->select('p.fecha, p.nivel_del_embalse, p.caudal_vertido, p.caudal_turbinado, p.caudal_de_aportes')
  59.                 ->orderBy('p.fecha''DESC')
  60.                 ->setMaxResults($limit)
  61.                 ->getQuery()
  62.                 ->getResult()
  63.         ;        
  64.     }    
  65. //    /**
  66. //     * @return IpaInforme[] Returns an array of IpaInforme objects
  67. //     */
  68. //    public function findByExampleField($value): array
  69. //    {
  70. //        return $this->createQueryBuilder('i')
  71. //            ->andWhere('i.exampleField = :val')
  72. //            ->setParameter('val', $value)
  73. //            ->orderBy('i.id', 'ASC')
  74. //            ->setMaxResults(10)
  75. //            ->getQuery()
  76. //            ->getResult()
  77. //        ;
  78. //    }
  79. //    public function findOneBySomeField($value): ?IpaInforme
  80. //    {
  81. //        return $this->createQueryBuilder('i')
  82. //            ->andWhere('i.exampleField = :val')
  83. //            ->setParameter('val', $value)
  84. //            ->getQuery()
  85. //            ->getOneOrNullResult()
  86. //        ;
  87. //    }
  88. }