Code Duplication    Length = 32-46 lines in 5 locations

system/modules/Ecommerce/models/Item/Option/Relation.php 1 location

@@ 14-59 (lines=46) @@
11
12
namespace Ecommerce\Item\Option;
13
14
class Relation extends \Model {
15
16
    public static $objectName = 'Связь каталога и опций';
17
    public static $labels = [
18
        'category_id' => 'Категория',
19
        'item_option_id' => 'Свойство',
20
        'date_create' => 'Свойство',
21
    ];
22
    public static $cols = [
23
        //Основные параметры
24
        'category_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'category'],
25
        'item_option_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'option'],
26
        //Системные
27
        'weight' => ['type' => 'number'],
28
        'date_create' => ['type' => 'dateTime']
29
    ];
30
    public static $forms = [
31
        'manager' => [
32
            'map' => [
33
                ['category_id', 'item_option_id']
34
            ]
35
        ]
36
    ];
37
    public static $dataManagers = [
38
        'manager' => [
39
            'cols' => [
40
                'item_option_id', 'date_create'
41
            ]
42
        ]
43
    ];
44
45
    public static function relations() {
46
        return [
47
            'category' => [
48
                'model' => 'Ecommerce\Category',
49
                'col' => 'category_id'
50
            ],
51
            'option' => [
52
                'model' => 'Ecommerce\Item\Option',
53
                'col' => 'item_option_id'
54
            ],
55
        ];
56
    }
57
58
}
59

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

@@ 14-50 (lines=37) @@
11
12
namespace Ecommerce;
13
14
class Discount extends \Model {
15
16
    public static $objectName = 'Скидка';
17
    public static $cols = [
18
        'name' => ['type' => 'text'],
19
        'type' => ['type' => 'select', 'source' => 'array', 'sourceArray' => ['sum' => 'Сумма', 'procent' => 'Процент']],
20
        'amount' => ['type' => 'decimal'],
21
        'condition' => ['type' => 'json'],
22
        //Системные параметры
23
        'date_create' => ['type' => 'dateTime'],
24
    ];
25
    public static $labels = [
26
        'name' => 'Название',
27
        'type' => 'Тип',
28
        'amount' => 'Значение',
29
        'condition' => 'Условие',
30
    ];
31
    public static $dataManagers = [
32
        'manager' => [
33
            'name' => 'Скидки',
34
            'cols' => [
35
                'name',
36
                'type',
37
                'amount',
38
            ],
39
        ],
40
    ];
41
    public static $forms = [
42
        'manager' => [
43
            'map' => [
44
                ['name'],
45
                ['type', 'amount'],
46
                //['condition']
47
            ]
48
        ]];
49
50
}
51

system/modules/Dashboard/models/Activity/Change.php 1 location

@@ 16-47 (lines=32) @@
13
14
namespace Dashboard\Activity;
15
16
class Change extends \Model {
17
18
    public static $logging = false;
19
    public static $cols = [
20
        'activity_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'activity'],
21
        'col' => ['type' => 'text'],
22
        'old' => ['type' => 'textarea'],
23
        'new' => ['type' => 'textarea'],
24
        'date_create' => ['type' => 'dateTime']
25
    ];
26
    public static $dataManagers = [
27
        'manager' => [
28
            'cols' => ['col', 'old', 'new'],
29
            'actions' => ['Edit' => ['access' => ['groups' => [0]]], 'Delete' => ['access' => ['groups' => [0]]]]
30
        ]
31
    ];
32
    public static $labels = [
33
        'col' => 'Поле',
34
        'old' => 'Старое значение',
35
        'new' => 'Новое значение'
36
    ];
37
38
    public static function relations() {
39
        return [
40
            'activity' => [
41
                'col' => 'activity_id',
42
                'model' => 'Dashboard\Activity'
43
            ]
44
        ];
45
    }
46
47
}
48

system/modules/Ecommerce/models/UserAdds/Value.php 1 location

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

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

@@ 14-55 (lines=42) @@
11
12
namespace Ecommerce\Delivery;
13
14
class CityLink extends \Model {
15
16
    public static $labels = [
17
        'delivery_id' => 'Тип доставки',
18
        'city_id' => 'Город',
19
        'date_create' => 'Дата создания'
20
    ];
21
    public static $cols = [
22
        'delivery_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'delivery'],
23
        'city_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'city'],
24
        'weight' => ['type' => 'number'],
25
        'date_create' => ['type' => 'dateTime']
26
    ];
27
    public static $dataManagers = [
28
        'manager' => [
29
            'name' => 'Города доставки',
30
            'cols' => ['city_id', 'date_create'],
31
            'sortMode' => true
32
        ]
33
    ];
34
    public static $forms = [
35
        'manager' => [
36
            'map' => [
37
                ['delivery_id', 'city_id'],
38
            ]
39
        ]
40
    ];
41
42
    public static function relations() {
43
        return [
44
            'city' => [
45
                'model' => 'Geography\City',
46
                'col' => 'city_id'
47
            ],
48
            'delivery' => [
49
                'model' => 'Ecommerce\Delivery',
50
                'col' => 'delivery_id'
51
            ],
52
        ];
53
    }
54
55
}
56