Completed
Push — master ( 594f71...a14e49 )
by Alexey
05:31
created

Country::relations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 10
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 10
loc 10
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
/**
4
 * Country model
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2016 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
12
namespace Geography;
13
14 View Code Duplication
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