FixtureRepository   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 5
dl 0
loc 32
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A findByGameDate() 0 4 1
A findByLeagueAndSeasonWithEvents() 0 13 1
1
<?php
2
3
namespace OSS\CoreBundle\Repository;
4
5
use Doctrine\ORM\EntityRepository;
6
use OSS\CoreBundle\Entity\Fixture;
7
use OSS\CoreBundle\Entity\GameDate;
8
use OSS\CoreBundle\Entity\League;
9
10
class FixtureRepository extends EntityRepository
11
{
12
    /**
13
     * @param GameDate $gameDate
14
     *
15
     * @return Fixture[]
16
     */
17
    public function findByGameDate(GameDate $gameDate)
18
    {
19
        return $this->findBy(array('season' => $gameDate->getSeason(), 'week' => $gameDate->getWeek()));
20
    }
21
22
    /**
23
     * @param League $league
24
     * @param int $season
25
     *
26
     * @return Fixture[]
27
     */
28
    public function findByLeagueAndSeasonWithEvents(League $league, $season)
29
    {
30
        $qb = $this->_em->createQueryBuilder();
31
        $qb->select(array('f', 'e'));
32
        $qb->from('CoreBundle:Fixture', 'f');
33
        $qb->where('f.league = :league');
34
        $qb->setParameter('league', $league->getId());
35
        $qb->andWhere('f.season = :season');
36
        $qb->setParameter('season', $season);
37
        $qb->join('f.events', 'e');
38
39
        return $qb->getQuery()->getResult();
40
    }
41
}
42