Completed
Push — master ( 6a8f56...0bbdea )
by greg
11s
created

Invitation   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 3
Bugs 2 Features 0
Metric Value
wmc 6
c 3
b 2
f 0
lcom 1
cbo 4
dl 0
loc 41
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getEntityRepository() 0 4 1
A findByUser() 0 4 1
A findByRequestKey() 0 4 1
A findByHost() 0 4 1
A findByGame() 0 4 1
A queryByGame() 0 10 1
1
<?php
2
namespace PlaygroundGame\Mapper;
3
4
use PlaygroundGame\Mapper\AbstractMapper;
5
6
class Invitation extends AbstractMapper
7
{
8
    public function findByUser($user)
9
    {
10
        return $this->getEntityRepository()->findBy(array('user'=>$user));
11
    }
12
13
    public function findByHost($user)
14
    {
15
        return $this->getEntityRepository()->findBy(array('host'=>$user));
16
    }
17
18
    public function findByRequestKey($key)
19
    {
20
        return $this->getEntityRepository()->findBy(array('requestKey'=>$key));
21
    }
22
23
    /**
24
     * @return \Heineken\Entity\Invitation
25
     */
26
    public function findByGame($game)
27
    {
28
        return $this->getEntityRepository()->findBy(array('game'=>$game));
29
    }
30
31
    public function getEntityRepository()
32
    {
33
        return $this->em->getRepository('PlaygroundGame\Entity\Invitation');
34
    }
35
36
    public function queryByGame($game)
37
    {
38
        $query = $this->em->createQuery(
39
            'SELECT i FROM PlaygroundGame\Entity\Invitation i
40
                WHERE i.game = :game
41
                ORDER BY i.requestKey ASC'
42
        );
43
        $query->setParameter('game', $game);
44
        return $query;
45
    }
46
}
47