<?php
namespace App\Repository;
use App\Entity\Rapper;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\DomCrawler\Form;
/**
* @extends ServiceEntityRepository<Rapper>
*
* @method Rapper|null find($id, $lockMode = null, $lockVersion = null)
* @method Rapper|null findOneBy(array $criteria, array $orderBy = null)
* @method Rapper[] findAll()
* @method Rapper[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class RapperRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Rapper::class);
}
/**
* @return Rapper[] Returns an array of Rapper objects
*/
public function findAllForLadderboard(): array
{
return $this->createQueryBuilder('r')
->orderBy('r.rank', 'DESC')
->getQuery()
->getResult()
;
}
public function save(Rapper $entity, bool $flush = false): Rapper
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
return $entity;
}
public function remove(Rapper $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return Rapper[] Returns an array of Rapper objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('r')
// ->andWhere('r.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('r.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Rapper
// {
// return $this->createQueryBuilder('r')
// ->andWhere('r.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}