Fields.php
1.21 KB
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
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "{{%fields}}".
*
* @property integer $id
* @property string $table_name
* @property integer $table_id
* @property string $value
* @property string $field_name
* @property string $field_type
*/
class Fields extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return '{{%fields}}';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['table_name', 'table_id',], 'required'],
[['table_id','language'], 'integer'],
[['table_name', 'value', 'field_name','field_type'], 'string', 'max' => 255]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'table_name' => 'Model Name',
'table_id' => 'Model ID',
'value' => 'Value',
'field_name' => 'Field Name',
'language' => 'Language',
];
}
public static function getData($id, $model, $type){
return self::find()->where(['table_id'=>$id, 'table_name'=>$model, 'field_type'=>$type])->all();
}
}