Completed
Push — master ( 1cdde8...6d8ac3 )
by Andrii
03:17
created

BillQuery::initSelect()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 23
ccs 0
cts 15
cp 0
rs 9.0856
c 0
b 0
f 0
cc 1
eloc 19
nc 1
nop 0
crap 2
1
<?php
2
3
namespace hiqdev\billing\hiapi\query;
4
5
class BillQuery extends \hiapi\query\Query
6
{
7
    public function initSelect()
8
    {
9
        return $this->select([
10
                'zb.obj_id as id',
11
                'zb.time',
12
                'zb.quantity    AS "quantity.quantity"',
13
                'zb.sum         AS "sum.amount"',
14
                'cu.name        AS "sum.currency"',
15
                'bt.name        AS "type.name"',
16
                'zc.obj_id      AS "customer.id"',
17
                'zc.login       AS "customer.login"',
18
                'zb.object_id   AS "target.id"',
19
                'oc.name        AS "target.type"',
20
            ])
21
            ->from('zbill           zb')
22
            ->leftJoin('zref        bt', 'bt.obj_id = zb.type_id')
23
            ->leftJoin('purse       zp', 'zp.obj_id = zb.purse_id')
24
            ->leftJoin('zclient     zc', 'zc.obj_id = zp.client_id')
25
            ->leftJoin('zref        cu', 'cu.obj_id = zp.currency_id')
26
            ->leftJoin('obj         zo', 'zo.obj_id = zb.object_id')
27
            ->leftJoin('zref        oc', 'oc.obj_id = zo.class_id')
28
        ;
29
    }
30
}
31