Code Duplication    Length = 33-43 lines in 4 locations

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

@@ 14-46 (lines=33) @@
11
12
namespace Ecommerce;
13
14
class Unit extends \Model
15
{
16
    public static $objectName = 'Единица измерения';
17
    public static $labels = [
18
        'name' => 'Название',
19
        'code' => 'Код',
20
        'international' => 'Международное обозначение',
21
    ];
22
    public static $cols = [
23
        //Основные параметры
24
        'name' => ['type' => 'text'],
25
        'code' => ['type' => 'text'],
26
        //Системные
27
        'international' => ['type' => 'text'],
28
        'date_create' => ['type' => 'dateTime'],
29
    ];
30
    public static $dataManagers = [
31
        'manager' => [
32
            'name' => 'Единицы измерения',
33
            'cols' => [
34
                'name', 'code', 'international'
35
            ]
36
        ]
37
    ];
38
    public static $forms = [
39
        'manager' => [
40
            'map' => [
41
                ['name', 'code', 'international']
42
            ]
43
        ]
44
    ];
45
46
}
47

system/modules/Geography/models/Country.php 1 location

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

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

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

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

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