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

CustomerQuery::attributesMap()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 3
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
crap 2
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