Code Duplication    Length = 38-42 lines in 2 locations

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

@@ 14-51 (lines=38) @@
11
12
namespace Ecommerce\Delivery;
13
14
class DeliveryFieldLink extends \Model
15
{
16
    static $cols = [
17
        'delivery_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'delivery'],
18
        'delivery_field_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'field'],
19
        'weight' => ['type' => 'number'],
20
        'date_create' => ['type' => 'dateTime']
21
    ];
22
    static $dataManagers = [
23
        'manager' => [
24
            'name' => 'Поля для доставки',
25
            'cols' => ['delivery_id', 'delivery_field_id', 'date_create'],
26
            //'sortMode' => true
27
        ]
28
    ];
29
    static $forms = [
30
        'manager' => [
31
            'map' => [
32
                ['delivery_id', 'delivery_field_id'],
33
            ]
34
        ]
35
    ];
36
37
    static function relations()
38
    {
39
        return [
40
            'field' => [
41
                'model' => 'Ecommerce\Delivery\Field',
42
                'col' => 'delivery_field_id'
43
            ],
44
            'delivery' => [
45
                'model' => 'Ecommerce\Delivery',
46
                'col' => 'delivery_id'
47
            ],
48
        ];
49
    }
50
51
}
52

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

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