Completed
Push — master ( 62221e...b4417e )
by Alexey
04:57
created

Input   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 1
c 3
b 1
f 0
lcom 0
cbo 1
dl 0
loc 52
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A relations() 0 13 1
1
<?php
2
3
/**
4
 * Input
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 UserForms;
13
14
class Input extends \Model
15
{
16
    public static $objectName = 'Поле формы';
17
    public static $labels = [
18
        'label' => 'Название',
19
        'type' => 'Тип',
20
        'required' => 'Обязательное',
21
        'params' => 'Параметры'
22
    ];
23
    public static $cols = [
24
        'label' => ['type' => 'text'],
25
        'type' => ['type' => 'text'],
26
        'required' => ['type' => 'bool'],
27
        'form_id' => [ 'type' => 'select', 'source' => 'relation', 'relation' => 'form'],
28
        'user_id' => [ 'type' => 'select', 'source' => 'relation', 'relation' => 'user'],
29
        'input_params' => ['type' => 'textarea'],
30
        'weight' => ['type' => 'number']
31
    ];
32
    public static $dataManagers = [
33
        'manager' => [
34
            'cols' => [
35
                'label',
36
                'type',
37
                'required',
38
            ],
39
            'sortMode' => true
40
        ]
41
    ];
42
    public static $forms = [
43
        'manager' => [
44
            'map' => [
45
                ['label', 'form_id'],
46
                ['type', 'required'],
47
            ]
48
        ]
49
    ];
50
51
    public static function relations()
52
    {
53
        return [
54
            'user' => [
55
                'model' => '\Users\User',
56
                'col' => 'user_id'
57
            ],
58
            'form' => [
59
                'model' => '\UserForms\Form',
60
                'col' => 'form_id',
61
            ],
62
        ];
63
    }
64
65
}
66