Completed
Push — master ( 4be90b...11f63d )
by Laurent
12:32 queued 08:08
created

OrdersRepository::getLastOrder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 11
loc 11
rs 9.4285
cc 1
eloc 8
nc 1
nop 1
1
<?php
2
3
namespace AppBundle\Entity;
4
5
use Doctrine\ORM\EntityRepository;
6
7
/**
8
 * OrdersRepository
9
 *
10
 * This class was generated by the Doctrine ORM. Add your own custom
11
 * repository methods below.
12
 */
13
class OrdersRepository extends EntityRepository
14
{
15
    /**
16
     * Renvoi les dernières commandes.
17
     *
18
     * @param integer $count Nombre d'élément à afficher
19
     * @return array Query result
20
     */
21 View Code Duplication
    public function getLastOrder($count)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
    {
23
        $query = $this->createQueryBuilder('o')
24
            ->where('o.status = 1')
25
            ->andWhere('o.delivdate < ' . date('d-m-Y'))
26
            ->orderBy('o.id', 'DESC')
27
            ->setMaxResults($count)
28
            ->getQuery();
29
30
        return $query->getResult();
31
    }
32
33
    /**
34
     * Renvoi les dernières commandes.
35
     *
36
     * @param integer $count Nombre d'élément à afficher
37
     * @return array Query result
38
     */
39 View Code Duplication
    public function getLastDelivery($count)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
40
    {
41
        $query = $this->createQueryBuilder('o')
42
            ->where('o.status = 1')
43
            ->andWhere('o.delivdate >= ' . date('d-m-Y'))
44
            ->orderBy('o.id', 'DESC')
45
            ->setMaxResults($count)
46
            ->getQuery();
47
48
        return $query->getResult();
49
    }
50
}
51