Test Failed
Push — master ( 249f62...0357c9 )
by Alexey
05:01
created

CityLink::relations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 12
loc 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Link between delivery and link
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2016 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
12
namespace Ecommerce\Delivery;
13
14 View Code Duplication
class CityLink extends \Model {
15
16
    public static $labels = [
17
        'delivery_id' => 'Тип доставки',
18
        'city_id' => 'Город',
19
        'date_create' => 'Дата создания'
20
    ];
21
    public static $cols = [
22
        'delivery_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'delivery'],
23
        'city_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'city'],
24
        'weight' => ['type' => 'number'],
25
        'date_create' => ['type' => 'dateTime']
26
    ];
27
    public static $dataManagers = [
28
        'manager' => [
29
            'name' => 'Города доставки',
30
            'cols' => ['city_id', 'date_create'],
31
            'sortMode' => true
32
        ]
33
    ];
34
    public static $forms = [
35
        'manager' => [
36
            'map' => [
37
                ['delivery_id', 'city_id'],
38
            ]
39
        ]
40
    ];
41
42
    public static function relations() {
43
        return [
44
            'city' => [
45
                'model' => 'Geography\City',
46
                'col' => 'city_id'
47
            ],
48
            'delivery' => [
49
                'model' => 'Ecommerce\Delivery',
50
                'col' => 'delivery_id'
51
            ],
52
        ];
53
    }
54
55
}
56