Completed
Push — master ( 6d8ac3...bc2e67 )
by Andrii
02:42
created

BillQuery::initSelect()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 26
ccs 0
cts 18
cp 0
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 22
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
                'cr.obj_id      AS "seller.id"',
19
                'cr.login       AS "seller.login"',
20
                'zb.object_id   AS "target.id"',
21
                'oc.name        AS "target.type"',
22
            ])
23
            ->from('zbill           zb')
24
            ->leftJoin('zref        bt', 'bt.obj_id = zb.type_id')
25
            ->leftJoin('purse       zp', 'zp.obj_id = zb.purse_id')
26
            ->leftJoin('zclient     zc', 'zc.obj_id = zp.client_id')
27
            ->leftJoin('zclient     cr', 'cr.obj_id = zc.seller_id')
28
            ->leftJoin('zref        cu', 'cu.obj_id = zp.currency_id')
29
            ->leftJoin('obj         zo', 'zo.obj_id = zb.object_id')
30
            ->leftJoin('zref        oc', 'oc.obj_id = zo.class_id')
31
        ;
32
    }
33
}
34