src/Repository/RapperRepository.php line 29

Open in your IDE?
  1. <?php
  2. namespace App\Repository;
  3. use App\Entity\Rapper;
  4. use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
  5. use Doctrine\Persistence\ManagerRegistry;
  6. use Symfony\Component\DomCrawler\Form;
  7. /**
  8.  * @extends ServiceEntityRepository<Rapper>
  9.  *
  10.  * @method Rapper|null find($id, $lockMode = null, $lockVersion = null)
  11.  * @method Rapper|null findOneBy(array $criteria, array $orderBy = null)
  12.  * @method Rapper[]    findAll()
  13.  * @method Rapper[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  14.  */
  15. class RapperRepository extends ServiceEntityRepository
  16. {
  17.     public function __construct(ManagerRegistry $registry)
  18.     {
  19.         parent::__construct($registryRapper::class);
  20.     }
  21.     /**
  22.      * @return Rapper[] Returns an array of Rapper objects
  23.      */
  24.     public function findAllForLadderboard(): array
  25.     {
  26.         return $this->createQueryBuilder('r')
  27.             ->orderBy('r.rank''DESC')
  28.             ->getQuery()
  29.             ->getResult()
  30.         ;
  31.     }
  32.     public function save(Rapper $entitybool $flush false): Rapper
  33.     {
  34.         $this->getEntityManager()->persist($entity);
  35.         if ($flush) {
  36.             $this->getEntityManager()->flush();
  37.         }
  38.         return $entity;
  39.     }
  40.     public function remove(Rapper $entitybool $flush false): void
  41.     {
  42.         $this->getEntityManager()->remove($entity);
  43.         if ($flush) {
  44.             $this->getEntityManager()->flush();
  45.         }
  46.     }
  47. //    /**
  48. //     * @return Rapper[] Returns an array of Rapper objects
  49. //     */
  50. //    public function findByExampleField($value): array
  51. //    {
  52. //        return $this->createQueryBuilder('r')
  53. //            ->andWhere('r.exampleField = :val')
  54. //            ->setParameter('val', $value)
  55. //            ->orderBy('r.id', 'ASC')
  56. //            ->setMaxResults(10)
  57. //            ->getQuery()
  58. //            ->getResult()
  59. //        ;
  60. //    }
  61. //    public function findOneBySomeField($value): ?Rapper
  62. //    {
  63. //        return $this->createQueryBuilder('r')
  64. //            ->andWhere('r.exampleField = :val')
  65. //            ->setParameter('val', $value)
  66. //            ->getQuery()
  67. //            ->getOneOrNullResult()
  68. //        ;
  69. //    }
  70. }