CommonListRepository.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace App\Repository;
  3. use App\Entity\CommonList;
  4. use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
  5. use Doctrine\Persistence\ManagerRegistry;
  6. /**
  7. * @extends ServiceEntityRepository<CommonList>
  8. */
  9. class CommonListRepository extends ServiceEntityRepository
  10. {
  11. public function __construct(ManagerRegistry $registry)
  12. {
  13. parent::__construct($registry, CommonList::class);
  14. }
  15. public function save(CommonList $commonList, bool $flush = false): void
  16. {
  17. $this->getEntityManager()->persist($commonList);
  18. if ($flush) {
  19. $this->getEntityManager()->flush();
  20. }
  21. }
  22. public function remove(CommonList $commonList, bool $flush = false): void
  23. {
  24. $this->getEntityManager()->remove($commonList);
  25. if ($flush) {
  26. $this->getEntityManager()->flush();
  27. }
  28. }
  29. // /**
  30. // * @return CommonList[] Returns an array of CommonList objects
  31. // */
  32. // public function findByExampleField($value): array
  33. // {
  34. // return $this->createQueryBuilder('c')
  35. // ->andWhere('c.exampleField = :val')
  36. // ->setParameter('val', $value)
  37. // ->orderBy('c.id', 'ASC')
  38. // ->setMaxResults(10)
  39. // ->getQuery()
  40. // ->getResult()
  41. // ;
  42. // }
  43. // public function findOneBySomeField($value): ?CommonList
  44. // {
  45. // return $this->createQueryBuilder('c')
  46. // ->andWhere('c.exampleField = :val')
  47. // ->setParameter('val', $value)
  48. // ->getQuery()
  49. // ->getOneOrNullResult()
  50. // ;
  51. // }
  52. }