public function getRanking(Chart $chart, $player = null, $limit = null)
    {
        $queryBuilder = $this->getRankingBaseQuery($chart);
        $queryBuilder
            ->andWhere('status.boolRanking = 1');

        if (null !== $limit && null !== $player) {
            $queryBuilder
                ->andWhere(
                    $queryBuilder->expr()->orX('pc.rank <= :maxRank', 'pc.player = :player')
                )
                ->setParameter('maxRank', $limit)
                ->setParameter('player', $player);
        } elseif (null !== $limit) {
            $queryBuilder
                ->andWhere('pc.rank <= :maxRank')
                ->setParameter('maxRank', $limit);
        }

        return $queryBuilder->getQuery()->getResult();
    }
public function getRanking(Chart $chart, $player = null, $limit = null)
    {
        $queryBuilder = $this->getRankingBaseQuery($chart);
        $queryBuilder
            ->andWhere('status.boolRanking = 1');

        if (null !== $limit && null !== $player) {
            $queryBuilder
                ->andWhere(
                    $queryBuilder->expr()->orX('pc.rank <= :maxRank', 'pc.player = :player')
                )
                ->setParameter('maxRank', $limit)
                ->setParameter('player', $player);
        } elseif (null !== $limit) {
            $queryBuilder
                ->andWhere('pc.rank <= :maxRank')
                ->setParameter('maxRank', $limit);
        }

        return $queryBuilder->getQuery()->getResult();
    }
public function getRanking ( Chart $ chart , $ player = null , $ limit = null ) { $ queryBuilder = $ this -> getRankingBaseQuery ( $ chart ) ; $ queryBuilder -> andWhere ( 'status.boolRanking = 1' ) ; if ( null !== $ limit && null !== $ player ) { $ queryBuilder -> andWhere ( $ queryBuilder -> expr ( ) -> orX ( 'pc.rank <= :maxRank' , 'pc.player = :player' ) ) -> setParameter ( 'maxRank' , $ limit ) -> setParameter ( 'player' , $ player ) ; } elseif ( null !== $ limit ) { $ queryBuilder -> andWhere ( 'pc.rank <= :maxRank' ) -> setParameter ( 'maxRank' , $ limit ) ; } return $ queryBuilder -> getQuery ( ) -> getResult ( ) ; }
Provides valid ranking.

@param \VideoGamesRecords\CoreBundle\Entity\Chart $chart
@param \VideoGamesRecords\CoreBundle\Entity\Player $player
@param int|null $limit

@return array
@todo
=> If idPlayer, search for the rank and display a range of -5 and +5
Provides valid ranking .