Completed
Push — master ( d5b4df...8b174f )
by Dmitry
03:04
created

CustomerQuery   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 26
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A attributesMap() 0 11 1
A initSelect() 0 6 1
1
<?php
2
3
namespace hiqdev\billing\hiapi\query;
4
5
use hiqdev\billing\hiapi\models\Customer;
6
7
class CustomerQuery extends \hiapi\query\Query
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $modelClass = Customer::class;
13
14
    protected function attributesMap()
15
    {
16
        return [
17
            'id' => 'zc.obj_id',
18
            'login' => 'zc.login',
19
            'seller' => [
20
                'id' => 'cr.obj_id',
21
                'login' => 'cr.login',
22
            ]
23
        ];
24
    }
25
26
    public function initSelect()
27
    {
28
        return $this->selectByFields($this->getFields())
29
            ->from('zclient         zc')
30
            ->leftJoin('zclient     cr', 'cr.obj_id = zc.seller_id');
31
    }
32
}
33