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) |
|
90 | |||
91 | /** |
||
92 | * @return ActiveRecord[] |
||
93 | */ |
||
94 | 8 | protected function getTranslateRelations() |
|
103 | |||
104 | /** |
||
105 | * @param ActiveRecord[] $models |
||
106 | */ |
||
107 | 6 | protected function setTranslateRelations($models) |
|
111 | |||
112 | /** |
||
113 | * @param string $language |
||
114 | * @param array $attributes |
||
115 | * @return ActiveRecord |
||
116 | */ |
||
117 | 5 | protected function createTranslation($language, $attributes = []) |
|
126 | |||
127 | /** |
||
128 | * @return \yii\db\ActiveQuery |
||
129 | */ |
||
130 | 9 | protected function getRelation() |
|
134 | |||
135 | /** |
||
136 | * @inheritdoc |
||
137 | */ |
||
138 | 11 | public function canGetProperty($name, $checkVars = true) |
|
144 | |||
145 | /** |
||
146 | * @inheritdoc |
||
147 | */ |
||
148 | 7 | public function canSetProperty($name, $checkVars = true) |
|
154 | |||
155 | /** |
||
156 | * @inheritdoc |
||
157 | */ |
||
158 | 11 | public function __get($name) |
|
170 | |||
171 | /** |
||
172 | * @inheritdoc |
||
173 | */ |
||
174 | 12 | public function __set($name, $value) |
|
186 | |||
187 | /** |
||
188 | * Returns a value indicating whether a method is defined. |
||
189 | * |
||
190 | * The default implementation is a call to php function `method_exists()`. |
||
191 | * You may override this method when you implemented the php magic method `__call()`. |
||
192 | * @param string $name the method name |
||
193 | * @return boolean whether the method is defined |
||
194 | */ |
||
195 | 6 | public function hasMethod($name) |
|
199 | |||
200 | /** |
||
201 | * Calls the named method which is not a class method. |
||
202 | * |
||
203 | * Do not call this method directly as it is a PHP magic method that |
||
204 | * will be implicitly called when an unknown method is being invoked. |
||
205 | * @param string $name the method name |
||
206 | * @param array $params method parameters |
||
207 | * @return mixed the method return value |
||
208 | */ |
||
209 | 1 | public function __call($name, $params) |
|
213 | |||
214 | /** |
||
215 | * @return bool |
||
216 | */ |
||
217 | 1 | public function isTranslated() |
|
221 | |||
222 | /** |
||
223 | * This read only relations designed for method $this->hasTranslate() |
||
224 | * @return \yii\db\ActiveQuery |
||
225 | */ |
||
226 | 3 | public function getHasTranslate() |
|
237 | |||
238 | /** |
||
239 | * @return \yii\db\ActiveQuery |
||
240 | */ |
||
241 | 8 | public function getCurrentTranslate() |
|
250 | } |
||
251 |