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() |
|
60 | |||
61 | 3 | public function eventAfterSave() |
|
65 | |||
66 | 1 | public function eventBeforeDelete() |
|
70 | |||
71 | /** |
||
72 | * Returns the translation model for the specified language. |
||
73 | * @param string|null $language |
||
74 | * @return ActiveRecord |
||
75 | */ |
||
76 | 8 | public function getTranslation($language = null) |
|
94 | |||
95 | /** |
||
96 | * @return ActiveRecord[] |
||
97 | */ |
||
98 | 8 | protected function getTranslateRelations() |
|
107 | |||
108 | /** |
||
109 | * @param ActiveRecord[] $models |
||
110 | */ |
||
111 | 6 | protected function setTranslateRelations($models) |
|
115 | |||
116 | /** |
||
117 | * @param string $language |
||
118 | * @param array $attributes |
||
119 | * @return ActiveRecord |
||
120 | */ |
||
121 | 5 | protected function createTranslation($language, $attributes = []) |
|
130 | |||
131 | /** |
||
132 | * @return \yii\db\ActiveQuery |
||
133 | */ |
||
134 | 9 | protected function getRelation() |
|
138 | |||
139 | /** |
||
140 | * @inheritdoc |
||
141 | */ |
||
142 | 11 | public function canGetProperty($name, $checkVars = true) |
|
148 | |||
149 | /** |
||
150 | * @inheritdoc |
||
151 | */ |
||
152 | 7 | public function canSetProperty($name, $checkVars = true) |
|
158 | |||
159 | /** |
||
160 | * @inheritdoc |
||
161 | */ |
||
162 | 11 | public function __get($name) |
|
174 | |||
175 | /** |
||
176 | * @inheritdoc |
||
177 | */ |
||
178 | 12 | public function __set($name, $value) |
|
190 | |||
191 | /** |
||
192 | * Returns a value indicating whether a method is defined. |
||
193 | * |
||
194 | * The default implementation is a call to php function `method_exists()`. |
||
195 | * You may override this method when you implemented the php magic method `__call()`. |
||
196 | * @param string $name the method name |
||
197 | * @return boolean whether the method is defined |
||
198 | */ |
||
199 | 6 | public function hasMethod($name) |
|
203 | |||
204 | /** |
||
205 | * Calls the named method which is not a class method. |
||
206 | * |
||
207 | * Do not call this method directly as it is a PHP magic method that |
||
208 | * will be implicitly called when an unknown method is being invoked. |
||
209 | * @param string $name the method name |
||
210 | * @param array $params method parameters |
||
211 | * @return mixed the method return value |
||
212 | */ |
||
213 | 1 | public function __call($name, $params) |
|
217 | |||
218 | /** |
||
219 | * @return bool |
||
220 | */ |
||
221 | 1 | public function isTranslated() |
|
225 | |||
226 | /** |
||
227 | * This read only relations designed for method $this->hasTranslate() |
||
228 | * @return \yii\db\ActiveQuery |
||
229 | */ |
||
230 | 3 | public function getHasTranslate() |
|
241 | |||
242 | /** |
||
243 | * @return \yii\db\ActiveQuery |
||
244 | */ |
||
245 | 8 | public function getCurrentTranslate() |
|
254 | } |
||
255 |