Blame view

common/models/TemplateLocation.php 2.03 KB
4253cbec   root   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
65
66
67
68
69
70
71
72
73
74
75
76
  <?php

  

  namespace common\models;

  

  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

   */

  class TemplateLocation extends \yii\db\ActiveRecord

  {

      /**

       * @inheritdoc

       */

      public static function tableName()

      {

          return 'template_location';

      }

  

      /**

       * @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()

      {

          return $this->hasMany(Banner::className(), ['template_location_id' => 'template_location_id']);

      }

  

      /**

       * @return \yii\db\ActiveQuery

       */

      public function getSliders()

      {

          return $this->hasMany(Slider::className(), ['template_location_id' => 'template_location_id']);

      }

  }