Completed
Push — sf2.7 ( cc13d7...fb6965 )
by Laurent
04:29
created

SupplierRepository::getSuppliers()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 23
rs 9.0856
cc 2
eloc 12
nc 2
nop 2
1
<?php
2
3
/**
4
 * Entité Supplier.
5
 *
6
 * PHP Version 5
7
 *
8
 * @author     Quétier Laurent <[email protected]>
9
 * @copyright  2014 Dev-Int GLSR
10
 * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
11
 *
12
 * @version    since 1.0.0
13
 *
14
 * @link       https://github.com/Dev-Int/glsr
15
 */
16
namespace AppBundle\Entity;
17
18
use Doctrine\ORM\EntityRepository;
19
use Doctrine\ORM\Tools\Pagination\Paginator;
20
21
/**
22
 * SupplierRepository Entité Supplier.
23
 *
24
 * @category   Entity
25
 */
26
class SupplierRepository extends EntityRepository
27
{
28
    /**
29
     * Renvoie les fournisseurs correspondant à la famille logistique
30
     * et sous-famille logistique de l'article en paramètre.
31
     *
32
     * @param AppBundle\Entity\Article $article Article sélectionné
33
     *
34
     * @return QueryBuilder Requête DQL
35
     */
36
    public function getSupplierForReassign($article)
37
    {
38
        $query = $this->createQueryBuilder('s')
39
            ->where('s.name != :idname')
40
            ->andWhere('s.family_log = :flname')
41
            ->andWhere('s.sub_family_log = :sflname')
42
            ->andWhere('s.active = 1')
43
            ->setParameters(
44
                array(
45
                    'idname' => $article->getSupplier()->getName(),
46
                    'flname' => $article->getFamilyLog(),
47
                    'sflname' => $article->getSubFamilyLog(),
48
                )
49
            )
50
            ->orderBy('s.name', 'ASC');
51
52
        return $query;
53
    }
54
}
55