Code Duplication    Length = 21-22 lines in 3 locations

system/modules/Callbacks/models/Category.php 1 location

@@ 46-67 (lines=22) @@
43
        ]
44
    ];
45
46
    public static function relations() {
47
        return [
48
            'callbacks' => [
49
                'type' => 'many',
50
                'model' => 'Callbacks\Callback',
51
                'col' => 'category_id',
52
            ],
53
            'parent' => [
54
                'model' => 'Callbacks\Category',
55
                'col' => 'parent_id'
56
            ],
57
            'image' => [
58
                'model' => 'Files\File',
59
                'col' => 'image_file_id'
60
            ],
61
            'catalogs' => [
62
                'type' => 'many',
63
                'model' => 'Callbacks\Category',
64
                'col' => 'parent_id',
65
            ]
66
        ];
67
    }
68
69
    public function resolveTemplate() {
70
        if ($this->template !== 'inherit') {

system/modules/Migrations/models/Migration/Map/Path.php 1 location

@@ 26-46 (lines=21) @@
23
        'date_create' => ['type' => 'dateTime'],
24
    ];
25
26
    public static function relations() {
27
        return [
28
            'map' => [
29
                'model' => 'Migrations\Migration\Map',
30
                'col' => 'map_id'
31
            ],
32
            'object' => [
33
                'model' => 'Migrations\Migration\Object',
34
                'col' => 'object_id'
35
            ],
36
            'childs' => [
37
                'type' => 'many',
38
                'model' => 'Migrations\Migration\Map\Path',
39
                'col' => 'parent_id'
40
            ],
41
            'parent' => [
42
                'model' => 'Migrations\Migration\Map\Path',
43
                'col' => 'parent_id'
44
            ]
45
        ];
46
    }
47
48
}
49

system/modules/Materials/models/Material.php 1 location

@@ 114-134 (lines=21) @@
111
        ]
112
    ];
113
114
    public static function relations() {
115
        return [
116
            'category' => [
117
                'model' => '\Materials\Category',
118
                'col' => 'category_id'
119
            ],
120
            'image' => [
121
                'model' => '\Files\File',
122
                'col' => 'image_file_id'
123
            ],
124
            'user' => [
125
                'model' => '\Users\User',
126
                'col' => 'user_id'
127
            ],
128
            'links' => [
129
                'type' => 'many',
130
                'model' => '\Materials\Material\Link',
131
                'col' => 'material_id'
132
            ]
133
        ];
134
    }
135
136
    public function getHref() {
137
        $href = !empty(\App::$primary->config['defaultModule']) && \App::$primary->config['defaultModule'] == 'Materials' ? '' : '/materials';