AreaLang.php
1.38 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
namespace common\modules\map\models;
use Yii;
use yii\helpers\ArrayHelper;
use thread\app\base\models\ActiveRecordLang;
use common\modules\map\Map as MainModule;
/**
* Class AreaLang
*
* @property integer $rid
* @property string $lang
* @property string $title
* @author Alla Kuzmenko
* @package common\modules\map\models
* @copyright (c), Thread
*/
class AreaLang extends ActiveRecordLang
{
const moduleName = 'map';
/**
* @return null|object|string
*/
public static function getDb()
{
return MainModule::getDb();
}
/**
* @return string
*/
public static function tableName()
{
return '{{%map_area_lang}}';
}
/**
* @return array
*/
public function rules()
{
return ArrayHelper::merge(parent::rules(), [
[['title'], 'required'],
['rid', 'exist', 'targetClass' => Area::class, 'targetAttribute' => 'id'],
['title', 'string', 'max' => 256]
]);
}
/**
* @return array
*/
public function scenarios()
{
return [
'backend' => ['title'],
];
}
/**
* @return array
*/
public function attributeLabels()
{
return [
'rid' => Yii::t('app', 'RID'),
'lang' => Yii::t('app', 'Lang'),
'title' => Yii::t('app', 'Title')
];
}
}