Completed
Push — master ( 6cd982...18aa30 )
by Alexey
05:03
created

Price::relations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 12
loc 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Link between delivery and link
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 Ecommerce\Delivery;
13
14 View Code Duplication
class Price extends \Model {
15
16
  public static $labels = [
17
      'delivery_id' => 'Тип доставки',
18
      'cart_price' => 'Сумма корзины',
19
      'price' => 'Стоимость доставки',
20
      'currency_id' => 'Валюта',
21
  ];
22
  public static $cols = [
23
      'delivery_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'delivery'],
24
      'cart_price' => ['type' => 'number'],
25
      'price' => ['type' => 'number'],
26
      'currency_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'currency'],
27
      'date_create' => ['type' => 'dateTime']
28
  ];
29
  public static $dataManagers = [
30
      'manager' => [
31
          'name' => 'Цены для стоимости корзин',
32
          'cols' => ['delivery_id', 'cart_price', 'price', 'currency_id'],
33
      ]
34
  ];
35
  public static $forms = [
36
      'manager' => [
37
          'map' => [
38
              ['delivery_id', 'currency_id'],
39
              ['cart_price', 'price'],
40
          ]
41
      ]
42
  ];
43
44
  public static function relations() {
45
    return [
46
        'delivery' => [
47
            'model' => 'Ecommerce\Delivery',
48
            'col' => 'delivery_id'
49
        ],
50
        'currency' => [
51
            'model' => 'Money\Currency',
52
            'col' => 'currency_id'
53
        ],
54
    ];
55
  }
56
57
}
58