Completed
Push — master ( 8717df...fdbe7f )
by Alexey
05:44
created

Block::relations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 13
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
/**
4
 * Warehouse block
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2015 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
12
namespace Ecommerce\Warehouse;
13
14
class Block extends \Model
15
{
16
    public static $cols = [
17
        //Основные параметры
18
        'cart_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'cart'],
19
        'item_offer_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'offer'],
20
        'count' => ['type' => 'text'],
21
        //Системные параметры
22
        'date_create' => ['type' => 'dateTime']
23
    ];
24
25
    public static function relations()
26
    {
27
        return [
28
            'cart' => [
29
                'model' => 'Ecommerce\Cart',
30
                'col' => 'cart_id'
31
            ],
32
            'offer' => [
33
                'model' => 'Ecommerce\Item\Offer',
34
                'col' => 'item_offer_id'
35
            ],
36
        ];
37
    }
38
39
    public static function indexes()
40
    {
41
        return [
42
            'ecommerce_warehousesBlockCart' => [
43
                'type' => 'INDEX',
44
                'cols' => [
45
                    'warehouse_block_cart_id'
46
                ]
47
            ],
48
            'ecommerce_warehousesBlockItem' => [
49
                'type' => 'INDEX',
50
                'cols' => [
51
                    'warehouse_block_item_offer_id'
52
                ]
53
            ],
54
        ];
55
    }
56
57
}
58