1 | <?php namespace Modules\Core\Doctrine; |
||
7 | trait Translatable |
||
8 | { |
||
9 | /** |
||
10 | * @param array $input |
||
11 | */ |
||
12 | public function fillTranslations(array $input) |
||
20 | |||
21 | /** |
||
22 | * Create or update the given field name |
||
23 | * @param string $fieldName |
||
24 | * @param string $locale |
||
25 | * @param string $value |
||
26 | */ |
||
27 | public function createOrUpdateTranslation($fieldName, $locale, $value) |
||
49 | |||
50 | /** |
||
51 | * Get the translation of the given field name |
||
52 | * @param string $fieldName |
||
53 | * @param string|null $locale |
||
54 | * @return string |
||
55 | */ |
||
56 | public function translation($fieldName, $locale = null) |
||
66 | |||
67 | /** |
||
68 | * @param string $fieldName |
||
69 | * @return mixed |
||
70 | */ |
||
71 | public function translatableGetter($fieldName) |
||
81 | |||
82 | /** |
||
83 | * @param $name |
||
84 | * @return mixed |
||
85 | */ |
||
86 | public function getRawField($name) |
||
90 | |||
91 | /** |
||
92 | * @return array |
||
93 | */ |
||
94 | private function getTranslatedFieldNamesForEntity() |
||
105 | |||
106 | /** |
||
107 | * Get the foreign key for the current class |
||
108 | * @return string |
||
109 | */ |
||
110 | private function getForeignKey() |
||
117 | |||
118 | /** |
||
119 | * Get the Translations class name |
||
120 | * @return string |
||
121 | */ |
||
122 | private function getTranslationClass() |
||
126 | } |
||
127 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: