Completed
Push — SF4 ( e72cbd...58e7de )
by Laurent
02:27
created

SupplierRepository::getSupplierForReassign()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * Entity Supplier.
5
 *
6
 * PHP Version 7
7
 *
8
 * @author    Quétier Laurent <[email protected]>
9
 * @copyright 2018 Dev-Int GLSR
10
 * @license   http://opensource.org/licenses/gpl-license.php GNU Public License
11
 *
12
 * @version GIT: $Id$
13
 *
14
 * @link https://github.com/Dev-Int/glsr
15
 */
16
namespace App\Repository\Settings;
17
18
use Doctrine\ORM\EntityRepository;
19
20
/**
21
 * SupplierRepository Entity.
22
 *
23
 * @category Entity
24
 */
25
class SupplierRepository extends EntityRepository
26
{
27
    /**
28
     * Returns the active providers corresponding to the logistic family
29
     * of the article in parameter.
30
     *
31
     * @param App\Entity\Settings\Supplier $supplier Selected supplier
32
     *
33
     * @return \Doctrine\ORM\QueryBuilder DQL query
34
     */
35
    public function getSupplierForReassign($supplier)
36
    {
37
        $query = $this->createQueryBuilder('s');
38
        $query
39
            ->select('s')
40
            ->where($query->expr()->neq('s.name', ':idname'))
41
            ->andWhere('s.familyLog = :flname')
42
            ->andWhere('s.active = true')
43
            ->setParameters(['idname' => $supplier->getName(), 'flname' => $supplier->getFamilyLog(),])
44
            ->orderBy('s.name', 'ASC');
45
46
        return $query;
47
    }
48
}
49