Code Duplication    Length = 42-57 lines in 6 locations

system/modules/Users/models/Social.php 1 location

@@ 14-62 (lines=49) @@
11
12
namespace Users;
13
14
class Social extends \Model
15
{
16
    public static $objectName = "Коннектор с социальной сетью";
17
    public static $cols = [
18
        'name' => ['type' => 'text'],
19
        'code' => ['type' => 'text'],
20
        'active' => ['type' => 'bool'],
21
        'object_name' => ['type' => 'text'],
22
        'config' => ['type' => 'dataManager', 'relation' => 'configs'],
23
        'date_create' => ['type' => 'dateTime']
24
    ];
25
    public static $labels = [
26
        'name' => 'Название',
27
        'code' => 'Код',
28
        'config' => 'Настройки',
29
        'active' => 'Активна',
30
        'object_name' => 'Название обработчика',
31
        'date_create' => 'Дата создания'
32
    ];
33
    public static $dataManagers = [
34
        'manager' => [
35
            'name' => "Коннекторы с социальными сетями",
36
            'cols' => [
37
                'name', 'active', 'code', 'object_name', 'config', 'date_create'
38
            ]
39
        ]
40
    ];
41
    public static $forms = [
42
        'manager' => [
43
            'map' => [
44
                ['name', 'code'],
45
                ['object_name', 'active'],
46
                ['config']
47
            ]
48
        ]
49
    ];
50
51
    public static function relations()
52
    {
53
        return [
54
            'configs' => [
55
                'type' => 'many',
56
                'model' => 'Users\Social\Config',
57
                'col' => 'social_id'
58
            ]
59
        ];
60
    }
61
62
}
63

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/Migrations/models/Migration/Object.php 1 location

@@ 14-61 (lines=48) @@
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
        'migration_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'migration'],
26
        'date_create' => ['type' => 'dateTime'],
27
    ];
28
    public static $dataManagers = [
29
        'manager' => [
30
            'name' => 'Объекты миграции',
31
            'cols' => ['name', 'code', 'type', 'migration_id']
32
        ]
33
    ];
34
    public static $forms = [
35
        'manager' => [
36
            'map' => [
37
                ['name', 'migration_id'],
38
                ['code', 'type'],
39
            ]
40
        ]
41
    ];
42
43
    public static function relations()
44
    {
45
        return [
46
            'migration' => [
47
                'model' => 'Migrations\Migration',
48
                'col' => 'migration_id'
49
            ],
50
            'params' => [
51
                'type' => 'many',
52
                'model' => 'Migrations\Migration\Object\Param',
53
                'col' => 'object_id',
54
                'where' => [
55
                    ['parent_id', 0]
56
                ]
57
            ]
58
        ];
59
    }
60
61
}
62

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