DiscountRepository   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A findActive() 0 11 1
A findCountBased() 0 12 1
1
<?php
2
3
/**
4
 * @author Rafał Muszyński <[email protected]>
5
 * @copyright 2015 Sourcefabric z.ú.
6
 * @license http://www.gnu.org/licenses/gpl-3.0.txt
7
 */
8
9
namespace Newscoop\PaywallBundle\Entity\Repository;
10
11
use Doctrine\ORM\EntityRepository;
12
13
/**
14
 * Discount repository.
15
 */
16
class DiscountRepository extends EntityRepository
17
{
18
    /**
19
     * Finds active discounts.
20
     */
21
    public function findActive()
22
    {
23
        $qb = $this
24
            ->createQueryBuilder('d')
25
            ->orderBy('d.countBased', 'DESC')
26
        ;
27
28
        return $qb
29
            ->getQuery()
30
        ;
31
    }
32
33
    /**
34
     * Finds count based discounts.
35
     */
36
    public function findCountBased()
37
    {
38
        $qb = $this
39
            ->createQueryBuilder('d')
40
            ->where('d.countBased = true')
41
            ->orderBy('d.createdAt', 'DESC')
42
        ;
43
44
        return $qb
45
            ->getQuery()
46
        ;
47
    }
48
}
49