Code Duplication    Length = 48-54 lines in 5 locations

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

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

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

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

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

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

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

@@ 13-62 (lines=50) @@
10
11
namespace Ecommerce\Cart;
12
13
class DeliveryInfo extends \Model
14
{
15
    public static $objectName = 'Информация о доставке';
16
    public static $labels = [
17
        'name' => 'Название',
18
        'cart_id' => 'Корзина',
19
        'delivery_field_id' => 'Поле',
20
        'value' => 'Значение',
21
    ];
22
    public static $cols = [
23
        //Основные параметры
24
        'name' => ['type' => 'text'],
25
        'cart_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'cart'],
26
        'delivery_field_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'field'],
27
        'value' => ['type' => 'text'],
28
        //Системные
29
        'date_create' => ['type' => 'dateTime'],
30
    ];
31
    public static $forms = [
32
        'manager' => [
33
            'map' => [
34
                ['name', 'value'],
35
                ['delivery_field_id', 'cart_id'],
36
            ]
37
        ]
38
    ];
39
    public static $dataManagers = [
40
        'manager' => [
41
            'cols' => [
42
                'name',
43
                'value'
44
            ]
45
        ]
46
    ];
47
48
    public static function relations()
49
    {
50
        return [
51
            'field' => [
52
                'model' => 'Ecommerce\Delivery\Field',
53
                'col' => 'delivery_field_id'
54
            ],
55
            'cart' => [
56
                'model' => 'Ecommerce\Cart',
57
                'col' => 'cart_id'
58
            ],
59
        ];
60
    }
61
62
}
63

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

@@ 14-62 (lines=49) @@
11
12
namespace Ecommerce\Cart;
13
14
class Info extends \Model
15
{
16
    public static $objectName = 'Информация';
17
    public static $labels = [
18
        'name' => 'Название',
19
        'value' => 'Значение',
20
        'useradds_field_id' => 'Поле',
21
        'cart_id' => 'Корзина'
22
    ];
23
    public static $cols = [
24
        'name' => ['type' => 'text'],
25
        'value' => ['type' => 'text'],
26
        'cart_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'cart'],
27
        'useradds_field_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'field'],
28
        //Системные параметры
29
        'date_create' => ['type' => 'dateTime'],
30
    ];
31
    public static $dataManagers = [
32
        'manager' => [
33
            'cols' => [
34
                'name',
35
                'value',
36
            ],
37
        ],
38
    ];
39
    public static $forms = [
40
        'manager' => [
41
            'map' => [
42
                ['name', 'value'],
43
                ['useradds_field_id', 'cart_id'],
44
            ]
45
        ]
46
    ];
47
48
    public static function relations()
49
    {
50
        return [
51
            'cart' => [
52
                'model' => 'Ecommerce\Cart',
53
                'col' => 'cart_id'
54
            ],
55
            'field' => [
56
                'model' => 'Ecommerce\UserAdds\Field',
57
                'col' => 'useradds_field_id'
58
            ]
59
        ];
60
    }
61
62
}
63