Completed
Push — master ( 6cd982...18aa30 )
by Alexey
05:03
created

Field::relations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 9
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Delivery field
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 Field extends \Model {
15
16
  public static $objectName = 'Поле доставки';
17
  public static $cols = [
18
      //Основные параметры
19
      'name' => ['type' => 'text'],
20
      'type' => ['type' => 'text'],
21
      'userfield' => ['type' => 'text'],
22
      'required' => ['type' => 'bool'],
23
      'save' => ['type' => 'bool'],
24
      'fieldItem'=>['type'=>'dataManager','relation'=>'fieldItems'],
25
      //Системные
26
      'date_create' => ['type' => 'dateTime'],
27
  ];
28
  public static $labels = [
29
      'name' => 'Название',
30
      'type' => 'Тип',
31
      'userfield' => 'Связь с данными пользователя',
32
      'required' => 'Обязательно',
33
      'save' => 'Сохраняется',
34
      'fieldItem' => 'Значения для списка',
35
  ];
36
  public static $dataManagers = [
37
      'manager' => [
38
          'cols' => [
39
              'name', 'type', 'userfield', 'required','fieldItem',  'save'
40
          ],
41
      ]
42
  ];
43
  public static $forms = [
44
      'manager' => [
45
          'map' => [
46
              ['name', 'type'],
47
              ['required', 'save'],
48
              [ 'userfield']
49
          ]
50
      ]
51
  ];
52
53
  public static function relations() {
54
    return [
55
        'fieldItems' => [
56
            'model' => 'Ecommerce\Delivery\Field\Item',
57
            'col' => 'delivery_field_id',
58
            'type' => 'many'
59
        ],
60
    ];
61
  }
62
63
}
64