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 | * @return ActiveRecord[] |
||
69 | */ |
||
70 | 8 | protected function getTranslateRelations() |
|
79 | |||
80 | /** |
||
81 | * @param ActiveRecord[] $models |
||
82 | */ |
||
83 | 6 | protected function setTranslateRelations($models) |
|
87 | |||
88 | /** |
||
89 | * @return \yii\db\ActiveQuery |
||
90 | */ |
||
91 | 9 | protected function getRelation() |
|
95 | |||
96 | /** |
||
97 | * Returns the translation model for the specified language. |
||
98 | * @param string|null $language |
||
99 | * @return ActiveRecord |
||
100 | */ |
||
101 | 8 | public function getTranslation($language = null) |
|
112 | |||
113 | /** |
||
114 | * @param string $language |
||
115 | * @param ActiveRecord[]|array $translations |
||
116 | * @return ActiveRecord |
||
117 | */ |
||
118 | 5 | protected function createTranslation($language, $translations) |
|
131 | |||
132 | /** |
||
133 | * @inheritdoc |
||
134 | */ |
||
135 | 11 | public function canGetProperty($name, $checkVars = true) |
|
141 | |||
142 | /** |
||
143 | * @inheritdoc |
||
144 | */ |
||
145 | 7 | public function canSetProperty($name, $checkVars = true) |
|
151 | |||
152 | /** |
||
153 | * @inheritdoc |
||
154 | */ |
||
155 | 11 | public function __get($name) |
|
167 | |||
168 | /** |
||
169 | * @inheritdoc |
||
170 | */ |
||
171 | 12 | public function __set($name, $value) |
|
183 | |||
184 | /** |
||
185 | * Returns a value indicating whether a method is defined. |
||
186 | * |
||
187 | * The default implementation is a call to php function `method_exists()`. |
||
188 | * You may override this method when you implemented the php magic method `__call()`. |
||
189 | * @param string $name the method name |
||
190 | * @return boolean whether the method is defined |
||
191 | */ |
||
192 | 6 | public function hasMethod($name) |
|
196 | |||
197 | /** |
||
198 | * Calls the named method which is not a class method. |
||
199 | * |
||
200 | * Do not call this method directly as it is a PHP magic method that |
||
201 | * will be implicitly called when an unknown method is being invoked. |
||
202 | * @param string $name the method name |
||
203 | * @param array $params method parameters |
||
204 | * @return mixed the method return value |
||
205 | */ |
||
206 | 1 | public function __call($name, $params) |
|
210 | |||
211 | /** |
||
212 | * @return bool |
||
213 | */ |
||
214 | 1 | public function isTranslated() |
|
218 | |||
219 | /** |
||
220 | * This read only relations designed for method $this->hasTranslate() |
||
221 | * @return \yii\db\ActiveQuery |
||
222 | */ |
||
223 | 3 | public function getHasTranslate() |
|
234 | |||
235 | /** |
||
236 | * @return \yii\db\ActiveQuery |
||
237 | */ |
||
238 | 8 | public function getCurrentTranslate() |
|
247 | } |
||
248 |