Test Failed
Push — master ( 45bc78...882099 )
by Alexey
05:03
created

Category::afterSave()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * INJI
4
 *
5
 * @author Alexey Krupskiy <[email protected]>
6
 * @link http://inji.ru/
7
 * @copyright 2017 Alexey Krupskiy
8
 * @license https://github.com/injitools/Inji/blob/master/LICENSE
9
 */
10
11
namespace Ecommerce\Catalog;
12
class Category extends \Model {
13
    static $cols = [
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $cols.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
14
        'catalog_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'catalog'],
15
        'category_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'category'],
16
    ];
17
    static $labels = [
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $labels.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
18
        'category_id' => 'Раздел товаров'
19
    ];
20
    static $dataManagers = [
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $dataManagers.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
21
        'manager' => [
22
            'cols' => ['category_id']
23
        ]
24
    ];
25
    static $forms = [
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $forms.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
26
        'manager' => [
27
            'map' => [['category_id']]
28
        ]
29
    ];
30
31
    public function afterSave() {
32
        $this->catalog->calcItemsCount();
33
    }
34
    public function afterDelete() {
35
        $this->catalog->calcItemsCount();
36
    }
37
38
    static function relations() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
39
        return [
40
            'catalog' => [
41
                'col' => 'catalog_id',
42
                'model' => 'Ecommerce\Catalog',
43
            ],
44
            'category' => [
45
                'col' => 'category_id',
46
                'model' => 'Ecommerce\Category',
47
            ]
48
        ];
49
    }
50
}