Blame view

common/models/TemplateLocation.php 1.95 KB
ba008812   Administrator   31.03.16 finish 1
1
2
  <?php
  
8774e5a3   Administrator   31.03.16 finish 1
3
  namespace common\models;
ba008812   Administrator   31.03.16 finish 1
4
  
8774e5a3   Administrator   31.03.16 finish 1
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  use Yii;
  
  /**
   * This is the model class for table "template_location".
   *
   * @property integer $template_location_id
   * @property string $template_location_name
   * @property string $template_location_title
   * @property integer $width
   * @property integer $height
   * @property integer $sort
   * @property integer $is_slider
   * @property integer $is_banner
   *
   * @property Banner[] $banners
   * @property Slider[] $sliders
   */
ba008812   Administrator   31.03.16 finish 1
22
23
  class TemplateLocation extends \yii\db\ActiveRecord
  {
8774e5a3   Administrator   31.03.16 finish 1
24
25
26
      /**
       * @inheritdoc
       */
ba008812   Administrator   31.03.16 finish 1
27
28
29
30
      public static function tableName()
      {
          return 'template_location';
      }
8774e5a3   Administrator   31.03.16 finish 1
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
  
      /**
       * @inheritdoc
       */
      public function rules()
      {
          return [
              [['template_location_name', 'width', 'height', 'sort'], 'required'],
              [['width', 'height', 'sort', 'is_slider', 'is_banner'], 'integer'],
              [['template_location_name', 'template_location_title'], 'string', 'max' => 255],
          ];
      }
  
      /**
       * @inheritdoc
       */
      public function attributeLabels()
      {
          return [
              'template_location_id' => Yii::t('app', 'Template Location ID'),
              'template_location_name' => Yii::t('app', 'Template Location Name'),
              'template_location_title' => Yii::t('app', 'Template Location Title'),
              'width' => Yii::t('app', 'Width'),
              'height' => Yii::t('app', 'Height'),
              'sort' => Yii::t('app', 'Sort'),
              'is_slider' => Yii::t('app', 'Is Slider'),
              'is_banner' => Yii::t('app', 'Is Banner'),
          ];
      }
  
      /**
       * @return \yii\db\ActiveQuery
       */
      public function getBanners()
ba008812   Administrator   31.03.16 finish 1
65
      {
8774e5a3   Administrator   31.03.16 finish 1
66
          return $this->hasMany(Banner::className(), ['template_location_id' => 'template_location_id']);
ba008812   Administrator   31.03.16 finish 1
67
68
      }
  
8774e5a3   Administrator   31.03.16 finish 1
69
70
71
72
      /**
       * @return \yii\db\ActiveQuery
       */
      public function getSliders()
ba008812   Administrator   31.03.16 finish 1
73
      {
8774e5a3   Administrator   31.03.16 finish 1
74
          return $this->hasMany(Slider::className(), ['template_location_id' => 'template_location_id']);
ba008812   Administrator   31.03.16 finish 1
75
      }
8774e5a3   Administrator   31.03.16 finish 1
76
  }