Completed
Push — master ( e918d3...e1c7ce )
by Andrii
01:58
created

CustomerQuery::initFrom()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
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 initFrom()
27
    {
28
        return $this->from('zclient zc')
29
            ->leftJoin('zclient     cr', 'cr.obj_id = zc.seller_id');
30
    }
31
}
32