Test Failed
Push — master ( 0357c9...5e4c03 )
by Alexey
06:57 queued 01:47
created

Warehouse   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 5
Bugs 4 Features 0
Metric Value
c 5
b 4
f 0
dl 0
loc 55
rs 10
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A relations() 0 8 1
1
<?php
2
3
/**
4
 * Warehouse
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2015 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
12
namespace Ecommerce;
13
/**
14
 * @property int $id
15
 * @property string $name
16
 * @property string $type
17
 * @property string $addresses
18
 * @property string $contacts
19
 * @property int $city_id
20
 * @property string $date_create
21
 */
22
class Warehouse extends \Model {
23
24
    public static $objectName = 'Склад';
25
    public static $labels = [
26
        'name' => 'Название',
27
        'time' => 'Время работы',
28
        'type' => 'Тип',
29
        'addresses' => 'Адрес',
30
        'city_id' => 'Город',
31
        'contacts' => 'Контакты',
32
    ];
33
    public static $cols = [
34
        //Основные параметры
35
        'name' => ['type' => 'text'],
36
        'type' => ['type' => 'select', 'source' => 'array', 'sourceArray' => ['sale' => 'Продажи', 'local' => 'Внутренний']],
37
        'city_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'city'],
38
        'addresses' => ['type' => 'textarea'],
39
        'contacts' => ['type' => 'textarea'],
40
        'time' => ['type' => 'text'],
41
        //Системные
42
        'date_create' => ['type' => 'dateTime'],
43
    ];
44
    public static $dataManagers = [
45
        'manager' => [
46
            'name' => 'Склады',
47
            'cols' => [
48
                'name',
49
                'city_id',
50
                'type',
51
                'addresses',
52
                'contacts',
53
            ],
54
        ],
55
    ];
56
    public static $forms = [
57
        'manager' => [
58
            'map' => [
59
                ['name', 'city'],
60
                ['type', 'time'],
61
                ['addresses'],
62
                ['contacts'],
63
            ]
64
        ]
65
    ];
66
67
    public static function relations() {
68
        return [
69
            'city' => [
70
                'model' => 'Geography/City',
71
                'col' => 'city_id'
72
            ]
73
        ];
74
    }
75
76
}
77