Code Duplication    Length = 38-42 lines in 3 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
    public 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
    public static $dataManagers = [
23
        'manager' => [
24
            'name' => 'Поля для доставки',
25
            'cols' => ['delivery_id', 'delivery_field_id', 'date_create'],
26
        ]
27
    ];
28
    public static $forms = [
29
        'manager' => [
30
            'map' => [
31
                ['delivery_id', 'delivery_field_id'],
32
            ]
33
        ]
34
    ];
35
36
    public static function relations()
37
    {
38
        return [
39
            'field' => [
40
                'model' => 'Ecommerce\Delivery\Field',
41
                'col' => 'delivery_field_id'
42
            ],
43
            'delivery' => [
44
                'model' => 'Ecommerce\Delivery',
45
                'col' => 'delivery_id'
46
            ],
47
        ];
48
    }
49
50
}
51

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

system/modules/Geography/models/City/Data.php 1 location

@@ 14-53 (lines=40) @@
11
12
namespace Geography\City;
13
14
class Data extends \Model
15
{
16
    public static $objectName = 'Данные города';
17
    public static $labels = [
18
        'code' => 'Код',
19
        'data' => 'Данные',
20
        'city_id' => 'Город',
21
        'date_create' => 'Дата создания',
22
    ];
23
    public static $cols = [
24
        'code' => ['type' => 'text'],
25
        'data' => ['type' => 'textarea'],
26
        'city_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'city'],
27
        'date_create' => ['type'=>'dateTime'],
28
    ];
29
    public static $dataManagers = [
30
        'manager' => [
31
            'cols' => ['code', 'data', 'date_create']
32
        ]
33
    ];
34
    public static $forms = [
35
        'manager' => [
36
            'map' => [
37
                ['code', 'city_id'],
38
                ['data']
39
            ]
40
        ]
41
    ];
42
43
    public static function relations()
44
    {
45
        return [
46
            'city' => [
47
                'model' => 'Geography\City',
48
                'col' => 'city_id'
49
            ],
50
        ];
51
    }
52
53
}
54