1 | <?php |
||
14 | class TranslationBehavior extends Behavior |
||
15 | { |
||
16 | /** |
||
17 | * @var string The name of the has-one relation. |
||
18 | */ |
||
19 | public $relationOne = 'translation'; |
||
20 | /** |
||
21 | * @var string The name of the has-many relation. |
||
22 | */ |
||
23 | public $relationMany = 'translations'; |
||
24 | /** |
||
25 | * @var string The language attribute name |
||
26 | */ |
||
27 | public $languageAttribute = 'language'; |
||
28 | /** |
||
29 | * @var int|string The default language. |
||
30 | */ |
||
31 | public $defaultLanguage = null; |
||
32 | /** |
||
33 | * @var string[] The attributes for translation. |
||
34 | */ |
||
35 | public $attributes = null; |
||
36 | |||
37 | /** |
||
38 | * @inheritdoc |
||
39 | */ |
||
40 | public function events() |
||
47 | |||
48 | /** |
||
49 | * @inheritdoc |
||
50 | */ |
||
51 | public function init() |
||
59 | |||
60 | /** |
||
61 | * @inheritdoc |
||
62 | */ |
||
63 | public function afterSave() |
||
72 | |||
73 | /** |
||
74 | * @inheritdoc |
||
75 | */ |
||
76 | public function canGetProperty($name, $checkVars = true) |
||
80 | |||
81 | /** |
||
82 | * @inheritdoc |
||
83 | */ |
||
84 | public function canSetProperty($name, $checkVars = true) |
||
88 | |||
89 | /** |
||
90 | * @inheritdoc |
||
91 | */ |
||
92 | public function __get($name) |
||
96 | |||
97 | /** |
||
98 | * @inheritdoc |
||
99 | */ |
||
100 | public function __set($name, $value) |
||
105 | |||
106 | public function loadTranslations($data) |
||
118 | |||
119 | /** |
||
120 | * Returns the translation model for the specified language. |
||
121 | * |
||
122 | * @param string|int|null $language |
||
123 | * @return ActiveRecord |
||
124 | */ |
||
125 | public function translate($language = null) |
||
150 | |||
151 | private function createTranslation($language) |
||
160 | } |
||
161 |