1 | <?php |
||
38 | class TranslatedBehavior extends BaseTranslatedBehavior |
||
39 | { |
||
40 | /** |
||
41 | * @var string the translations relation name |
||
42 | */ |
||
43 | public $translateRelation; |
||
44 | /** |
||
45 | * @var string the translations model language attribute name |
||
46 | */ |
||
47 | public $languageAttribute = 'lang_id'; |
||
48 | |||
49 | /** |
||
50 | * @inheritdoc |
||
51 | */ |
||
52 | 12 | public function events() |
|
66 | |||
67 | /** |
||
68 | * Returns the translation model for the specified language. |
||
69 | * @param string|null $language |
||
70 | * @return ActiveRecord |
||
71 | */ |
||
72 | 8 | public function getTranslation($language = null) |
|
96 | |||
97 | /** |
||
98 | * @return ActiveRecord[] |
||
99 | */ |
||
100 | 8 | protected function getTranslateRelations() |
|
109 | |||
110 | /** |
||
111 | * @param ActiveRecord[] $models |
||
112 | */ |
||
113 | 6 | protected function setTranslateRelations($models) |
|
117 | |||
118 | /** |
||
119 | * @return \yii\db\ActiveQuery |
||
120 | */ |
||
121 | 9 | protected function getRelation() |
|
125 | |||
126 | /** |
||
127 | * @inheritdoc |
||
128 | */ |
||
129 | 11 | public function canGetProperty($name, $checkVars = true) |
|
135 | |||
136 | /** |
||
137 | * @inheritdoc |
||
138 | */ |
||
139 | 7 | public function canSetProperty($name, $checkVars = true) |
|
145 | |||
146 | /** |
||
147 | * @inheritdoc |
||
148 | */ |
||
149 | 11 | public function __get($name) |
|
161 | |||
162 | /** |
||
163 | * @inheritdoc |
||
164 | */ |
||
165 | 12 | public function __set($name, $value) |
|
177 | |||
178 | /** |
||
179 | * Returns a value indicating whether a method is defined. |
||
180 | * |
||
181 | * The default implementation is a call to php function `method_exists()`. |
||
182 | * You may override this method when you implemented the php magic method `__call()`. |
||
183 | * @param string $name the method name |
||
184 | * @return boolean whether the method is defined |
||
185 | */ |
||
186 | 6 | public function hasMethod($name) |
|
190 | |||
191 | /** |
||
192 | * Calls the named method which is not a class method. |
||
193 | * |
||
194 | * Do not call this method directly as it is a PHP magic method that |
||
195 | * will be implicitly called when an unknown method is being invoked. |
||
196 | * @param string $name the method name |
||
197 | * @param array $params method parameters |
||
198 | * @return mixed the method return value |
||
199 | */ |
||
200 | 1 | public function __call($name, $params) |
|
204 | |||
205 | /** |
||
206 | * @return bool |
||
207 | */ |
||
208 | 1 | public function isTranslated() |
|
212 | |||
213 | /** |
||
214 | * This read only relations designed for method $this->hasTranslate() |
||
215 | * @return \yii\db\ActiveQuery |
||
216 | */ |
||
217 | 3 | public function getHasTranslate() |
|
228 | |||
229 | /** |
||
230 | * @return \yii\db\ActiveQuery |
||
231 | */ |
||
232 | 8 | public function getCurrentTranslate() |
|
241 | } |
||
242 |