Code Duplication    Length = 19-20 lines in 2 locations

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

@@ 14-33 (lines=20) @@
11
namespace Ecommerce;
12
13
14
class Catalog extends \Model {
15
    static $cols = [
16
        'name' => ['type' => 'text'],
17
        'parent_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'parent']
18
    ];
19
20
    static function relations() {
21
        return [
22
            'parent' => [
23
                'model' => 'Ecommerce\Catalog',
24
                'col' => 'parent_id'
25
            ],
26
            'categories'=>[
27
                'type'=>'many',
28
                'col'=>'catalog_id',
29
                'model'=>'Ecommerce\Catalog\Category'
30
            ]
31
        ];
32
    }
33
}

system/modules/Ecommerce/models/Catalog/Category.php 1 location

@@ 12-30 (lines=19) @@
9
 */
10
11
namespace Ecommerce\Catalog;
12
class Category extends \Model {
13
    static $cols = [
14
        'catalog_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'catalog'],
15
        'category_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'category'],
16
    ];
17
18
    static function relations() {
19
        return [
20
            'catalog' => [
21
                'col' => 'catalog_id',
22
                'model' => 'Ecommerce\Catalog',
23
            ],
24
            'category' => [
25
                'col' => 'category_id',
26
                'model' => 'Ecommerce\Category',
27
            ]
28
        ];
29
    }
30
}