Completed
Push — master ( eadc6b...c5068c )
by Andrii
13:42
created

CustomerQuery   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 10
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A attributesMap() 0 8 1
A initFrom() 0 4 1
1
<?php
2
/**
3
 * API for Billing
4
 *
5
 * @link      https://github.com/hiqdev/billing-hiapi
6
 * @package   billing-hiapi
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\billing\hiapi\customer;
12
13
use hiqdev\billing\hiapi\models\Customer;
14
15
class CustomerQuery extends \hiqdev\yii\DataMapper\query\Query
16
{
17
    /**
18
     * @var string
19
     */
20
    protected $modelClass = Customer::class;
21
22
    protected function attributesMap()
23
    {
24
        return [
25
            'id' => 'zc.obj_id',
26
            'login' => 'zc.login',
27
            'seller' => [
28
                'id' => 'cr.obj_id',
29
                'login' => 'cr.login',
30
            ],
31
        ];
32
    }
33
34
    public function initFrom()
35
    {
36
        return $this->from('zclient zc')
37
            ->leftJoin('zclient     cr', 'cr.obj_id = zc.seller_id');
38
    }
39
}
40