Test Failed
Push — master ( 48ddb2...dea459 )
by David
11:07
created

CartRepository::getNonOrderedCarts()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace GGGGino\SkuskuCartBundle\Repository;
4
use GGGGino\SkuskuCartBundle\Model\SkuskuCart;
5
use GGGGino\SkuskuCartBundle\Model\SkuskuCustomerInterface;
6
7
/**
8
 * CartRepository
9
 *
10
 * This class was generated by the Doctrine ORM. Add your own custom
11
 * repository methods below.
12
 */
13
class CartRepository extends \Doctrine\ORM\EntityRepository
14
{
15
    /**
16
     * Prendo tutti i carrelli attivi non eliminati
17
     */
18
    public function getNonOrderedCarts()
19
    {
20
        $qb = $this->createQueryBuilder('c')
21
            ->andWhere('c.status = :status')
22
            ->setParameter('status', SkuskuCart::STATUS_INITIAL)
23
            ->getQuery();
24
25
        return $qb->execute();
26
    }
27
28
    /**
29
     * Prendo tutti i carrelli attivi non eliminati
30
     */
31
    public function getOneNonOrderedCartByCustomer(SkuskuCustomerInterface $customer)
32
    {
33
        $qb = $this->createQueryBuilder('c')
34
            ->where('c.status = :status')
35
            ->andWhere('c.customer = :customer')
36
            ->setParameter('status', SkuskuCart::STATUS_INITIAL)
37
            ->setParameter('customer', $customer)
38
            ->setMaxResults(1)
39
            ->getQuery();
40
41
        return $qb->getOneOrNullResult();
42
    }
43
}
44