Code Duplication    Length = 42-57 lines in 7 locations

system/modules/Users/models/User/Invite.php 1 location

@@ 14-70 (lines=57) @@
11
12
namespace Users\User;
13
14
class Invite extends \Model
15
{
16
    public static $objectName = "Код пришлашения";
17
    public static $labels = [
18
        'code' => 'Код',
19
        'type' => 'Тип',
20
        'user_id' => 'Пользователь',
21
        'limit' => 'Лимит приглашений',
22
        'count' => 'Использовано',
23
        'date_create' => 'Дата',
24
    ];
25
    public static $cols = [
26
        'code' => ['type' => 'text'],
27
        'type' => ['type' => 'text'],
28
        'limit' => ['type' => 'number'],
29
        'count' => ['type' => 'number'],
30
        'user_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'user'],
31
        'date_create' => ['type' => 'dateTime']
32
    ];
33
    public static $dataManagers = [
34
        'manager' => [
35
            'cols' => [
36
                'code',
37
                'type',
38
                'user_id',
39
                'limit',
40
                'count',
41
                'date_create'
42
            ],
43
        ],
44
    ];
45
    public static $forms = [
46
        'manager' => [
47
            'map' => [
48
                ['code', 'type',],
49
                ['user_id'],
50
                ['limit', 'count'],
51
            ]
52
        ]
53
    ];
54
55
    public static function relations()
56
    {
57
        return [
58
            'user' => [
59
                'model' => 'Users\User',
60
                'col' => 'user_id'
61
            ],
62
        ];
63
    }
64
65
    public function name()
66
    {
67
        return $this->code;
68
    }
69
70
}
71

system/modules/Ecommerce/models/Card/Level.php 1 location

@@ 14-65 (lines=52) @@
11
12
namespace Ecommerce\Card;
13
14
class Level extends \Model
15
{
16
    public static $objectName = 'Уровень карты';
17
    public static $cols = [
18
        //Основные параметры
19
        'name' => ['type' => 'text'],
20
        'sum' => ['type' => 'text'],
21
        'card_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'card'],
22
        'discount_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'discount'],
23
        //Системные параметры
24
        'date_create' => ['type' => 'dateTime'],
25
    ];
26
    public static $labels = [
27
        'name' => 'Название',
28
        'card_id' => 'Карта',
29
        'discount_id' => 'Скидка',
30
        'sum' => 'Порог накопления',
31
    ];
32
    public static $dataManagers = [
33
        'manager' => [
34
            'name' => 'Бонусные карты',
35
            'cols' => [
36
                'name',
37
                'sum',
38
                'card_id',
39
                'discount_id',
40
            ],
41
        ],
42
    ];
43
    public static $forms = [
44
        'manager' => [
45
            'map' => [
46
                ['name', 'sum'],
47
                ['card_id', 'discount_id'],
48
            ]
49
    ]];
50
51
    public static function relations()
52
    {
53
        return [
54
            'card' => [
55
                'model' => 'Ecommerce\Card',
56
                'col' => 'card_id'
57
            ],
58
            'discount' => [
59
                'model' => 'Ecommerce\Discount',
60
                'col' => 'discount_id'
61
            ]
62
        ];
63
    }
64
65
}
66

system/modules/UserForms/models/Form.php 1 location

@@ 14-68 (lines=55) @@
11
12
namespace UserForms;
13
14
class Form extends \Model
15
{
16
    public static $objectName = 'Форма обращения с сайта';
17
    public static $labels = [
18
        'name' => 'Название',
19
        'description' => 'Описание',
20
        'user_id' => 'Пользователь',
21
        'inputs' => 'Поля формы',
22
        'date_create' => 'Дата'
23
    ];
24
    public static $cols = [
25
        'name' => ['type' => 'text'],
26
        'description' => ['type' => 'html'],
27
        'user_id' => [ 'type' => 'select', 'source' => 'relation', 'relation' => 'user'],
28
        'date_create' => ['type' => 'dateTime'],
29
        //Менеджеры
30
        'inputs' => [ 'type' => 'dataManager', 'relation' => 'inputs'],
31
    ];
32
    public static $dataManagers = [
33
        'manager' => [
34
            'cols' => [
35
                'name',
36
                'inputs',
37
                'user_id',
38
                'date_create',
39
            ]
40
        ]
41
    ];
42
    public static $forms = [
43
        'manager' => [
44
            'name' => 'Форма приема обращений с сайта',
45
            'map' => [
46
                ['name'],
47
                ['description'],
48
                ['inputs'],
49
            ]
50
        ]
51
    ];
52
53
    public static function relations()
54
    {
55
        return [
56
            'user' => [
57
                'model' => '\Users\User',
58
                'col' => 'user_id'
59
            ],
60
            'inputs' => [
61
                'type' => 'many',
62
                'model' => '\UserForms\Input',
63
                'col' => 'form_id',
64
            ],
65
        ];
66
    }
67
68
}
69

system/modules/Ecommerce/models/Cart/Stage.php 1 location

@@ 14-55 (lines=42) @@
11
12
namespace Ecommerce\Cart;
13
14
class Stage extends \Model
15
{
16
    public static $objectName = 'Этап наполнения корзины';
17
    public static $cols = [
18
        'sum' => ['type' => 'decimal'],
19
        'currency_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'currency'],
20
        'type' => ['type' => 'select', 'source' => 'array', 'sourceArray' => ['discount' => 'Скидка']],
21
        'value' => ['type' => 'text'],
22
        'group' => ['type' => 'text']
23
    ];
24
    public static $labels = [
25
        'sum' => 'Сумма',
26
        'type' => 'Тип',
27
        'group' => 'Группа',
28
        'currency_id' => 'Валюта',
29
        'value' => 'Значение'
30
    ];
31
    public static $dataManagers = [
32
        'manager' => [
33
            'cols' => ['sum', 'currency_id', 'type', 'value', 'group']
34
        ]
35
    ];
36
    public static $forms = [
37
        'manager' => [
38
            'map' => [
39
                ['sum', 'currency_id'],
40
                ['type', 'value', 'group']
41
            ]
42
        ]
43
    ];
44
45
    public static function relations()
46
    {
47
        return [
48
            'currency' => [
49
                'model' => 'Money\Currency',
50
                'col' => 'currency_id'
51
            ]
52
        ];
53
    }
54
55
}
56

system/modules/Migrations/models/Migration/Object.php 1 location

@@ 14-62 (lines=49) @@
11
12
namespace Migrations\Migration;
13
14
class Object extends \Model
15
{
16
    public static $objectName = 'Объект миграции';
17
    public static $labels = [
18
        'name' => 'Название',
19
        'migration_id' => 'Миграция данных'
20
    ];
21
    public static $cols = [
22
        'name' => ['type' => 'text'],
23
        'code' => ['type' => 'text'],
24
        'model' => ['type' => 'text'],
25
        'clear' => ['type' => 'text'],
26
        'migration_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'migration'],
27
        'date_create' => ['type' => 'dateTime'],
28
    ];
29
    public static $dataManagers = [
30
        'manager' => [
31
            'name' => 'Объекты миграции',
32
            'cols' => ['name', 'code', 'type', 'migration_id']
33
        ]
34
    ];
35
    public static $forms = [
36
        'manager' => [
37
            'map' => [
38
                ['name', 'migration_id'],
39
                ['code', 'type'],
40
            ]
41
        ]
42
    ];
43
44
    public static function relations()
45
    {
46
        return [
47
            'migration' => [
48
                'model' => 'Migrations\Migration',
49
                'col' => 'migration_id'
50
            ],
51
            'params' => [
52
                'type' => 'many',
53
                'model' => 'Migrations\Migration\Object\Param',
54
                'col' => 'object_id',
55
                'where' => [
56
                    ['parent_id', 0]
57
                ]
58
            ]
59
        ];
60
    }
61
62
}
63

system/modules/Ecommerce/models/Delivery/Field.php 1 location

@@ 14-63 (lines=50) @@
11
12
namespace Ecommerce\Delivery;
13
14
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

system/modules/Ecommerce/models/Delivery/Price.php 1 location

@@ 14-57 (lines=44) @@
11
12
namespace Ecommerce\Delivery;
13
14
class Price extends \Model {
15
16
  public static $labels = [
17
      'delivery_id' => 'Тип доставки',
18
      'cart_price' => 'Сумма корзины',
19
      'price' => 'Стоимость доставки',
20
      'currency_id' => 'Валюта',
21
  ];
22
  public static $cols = [
23
      'delivery_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'delivery'],
24
      'cart_price' => ['type' => 'number'],
25
      'price' => ['type' => 'number'],
26
      'currency_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'currency'],
27
      'date_create' => ['type' => 'dateTime']
28
  ];
29
  public static $dataManagers = [
30
      'manager' => [
31
          'name' => 'Цены для стоимости корзин',
32
          'cols' => ['delivery_id', 'cart_price', 'price', 'currency_id'],
33
      ]
34
  ];
35
  public static $forms = [
36
      'manager' => [
37
          'map' => [
38
              ['delivery_id', 'currency_id'],
39
              ['cart_price', 'price'],
40
          ]
41
      ]
42
  ];
43
44
  public static function relations() {
45
    return [
46
        'delivery' => [
47
            'model' => 'Ecommerce\Delivery',
48
            'col' => 'delivery_id'
49
        ],
50
        'currency' => [
51
            'model' => 'Money\Currency',
52
            'col' => 'currency_id'
53
        ],
54
    ];
55
  }
56
57
}
58