Completed
Push — master ( 51e7b9...4b0341 )
by Alexey
05:48
created

DeliveryInfo::relations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 13
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 13
loc 13
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
/**
4
 * Delivery user info
5
 * @author Alexey Krupskiy <[email protected]>
6
 * @link http://inji.ru/
7
 * @copyright 2016 Alexey Krupskiy
8
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
9
 */
10
11
namespace Ecommerce\Cart;
12
13 View Code Duplication
class DeliveryInfo extends \Model
14
{
15
    public static $objectName = 'Информация о доставке';
16
    public static $labels = [
17
        'name' => 'Название',
18
        'cart_id' => 'Корзина',
19
        'delivery_field_id' => 'Поле',
20
        'value' => 'Значение',
21
    ];
22
    public static $cols = [
23
        //Основные параметры
24
        'name' => ['type' => 'text'],
25
        'cart_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'cart'],
26
        'delivery_field_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'field'],
27
        'value' => ['type' => 'text'],
28
        //Системные
29
        'date_create' => ['type' => 'dateTime'],
30
    ];
31
    public static $forms = [
32
        'manager' => [
33
            'map' => [
34
                ['name', 'value'],
35
                ['delivery_field_id', 'cart_id'],
36
            ]
37
        ]
38
    ];
39
    public static $dataManagers = [
40
        'manager' => [
41
            'cols' => [
42
                'name',
43
                'value'
44
            ]
45
        ]
46
    ];
47
48
    public static function relations()
49
    {
50
        return [
51
            'field' => [
52
                'model' => 'Ecommerce\Delivery\Field',
53
                'col' => 'delivery_field_id'
54
            ],
55
            'cart' => [
56
                'model' => 'Ecommerce\Cart',
57
                'col' => 'cart_id'
58
            ],
59
        ];
60
    }
61
62
}
63