d55d2fe0
Yarik
Multilanguage
|
1
|
<?php
|
d55d2fe0
Yarik
Multilanguage
|
2
|
|
5c2eb7c8
Yarik
Big commit almost...
|
3
4
5
6
7
|
namespace common\models;
use common\modules\language\models\Language;
use Yii;
use yii\db\ActiveRecord;
|
d55d2fe0
Yarik
Multilanguage
|
8
9
|
/**
|
5c2eb7c8
Yarik
Big commit almost...
|
10
|
* This is the model class for table "seo_category_lang".
|
4428da8c
Yarik
Almost all databa...
|
11
|
*
|
5c2eb7c8
Yarik
Big commit almost...
|
12
13
|
* @property integer $seo_category_id
* @property integer $language_id
|
8af13427
Yarik
For leha commit.
|
14
|
* @property string $title
|
5c2eb7c8
Yarik
Big commit almost...
|
15
16
|
* @property Language $language
* @property SeoCategory $seoCategory
|
d55d2fe0
Yarik
Multilanguage
|
17
|
*/
|
5c2eb7c8
Yarik
Big commit almost...
|
18
|
class SeoCategoryLang extends ActiveRecord
|
d55d2fe0
Yarik
Multilanguage
|
19
|
{
|
5c2eb7c8
Yarik
Big commit almost...
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
public static function primaryKey()
{
return [
'seo_category_id',
'language_id',
];
}
/**
* @inheritdoc
*/
public static function tableName()
{
return 'seo_category_lang';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[
|
8af13427
Yarik
For leha commit.
|
44
|
[ 'title' ],
|
5c2eb7c8
Yarik
Big commit almost...
|
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
'string',
'max' => 255,
],
[
[
'seo_category_id',
'language_id',
],
'unique',
'targetAttribute' => [
'seo_category_id',
'language_id',
],
'message' => 'The combination of Seo Category ID and Language ID has already been taken.',
],
[
[ 'language_id' ],
'exist',
'skipOnError' => true,
'targetClass' => Language::className(),
|
8af13427
Yarik
For leha commit.
|
65
|
'targetAttribute' => [ 'language_id' => 'id' ],
|
5c2eb7c8
Yarik
Big commit almost...
|
66
67
68
69
70
71
|
],
[
[ 'seo_category_id' ],
'exist',
'skipOnError' => true,
'targetClass' => SeoCategory::className(),
|
4428da8c
Yarik
Almost all databa...
|
72
|
'targetAttribute' => [ 'seo_category_id' => 'id' ],
|
5c2eb7c8
Yarik
Big commit almost...
|
73
74
75
76
77
78
79
80
81
82
83
84
|
],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'seo_category_id' => Yii::t('app', 'seo_category_id'),
'language_id' => Yii::t('app', 'language_id'),
|
4428da8c
Yarik
Almost all databa...
|
85
|
'title' => Yii::t('app', 'name'),
|
5c2eb7c8
Yarik
Big commit almost...
|
86
87
88
89
90
91
92
93
|
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getLanguage()
{
|
8af13427
Yarik
For leha commit.
|
94
|
return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]);
|
5c2eb7c8
Yarik
Big commit almost...
|
95
96
97
98
99
100
101
|
}
/**
* @return \yii\db\ActiveQuery
*/
public function getSeoCategory()
{
|
4428da8c
Yarik
Almost all databa...
|
102
|
return $this->hasOne(SeoCategory::className(), [ 'id' => 'seo_category_id' ]);
|
5c2eb7c8
Yarik
Big commit almost...
|
103
|
}
|
d55d2fe0
Yarik
Multilanguage
|
104
|
}
|