File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,14 @@ class TranslateableBehavior extends Behavior
3434 * @var string[] the list of attributes to be translated
3535 */
3636 public $ translationAttributes ;
37+
38+ /**
39+ * Temp buffer for entity relations.
40+ *
41+ * @var array
42+ */
43+ protected $ relationsBuffer = [];
44+
3745
3846 /**
3947 * @inheritdoc
@@ -83,6 +91,8 @@ public function getTranslation($language = null)
8391
8492 foreach ($ translations as $ translation ) {
8593 if ($ translation ->getAttribute ($ this ->translationLanguageAttribute ) === $ language ) {
94+ $ this ->relationsBuffer [] = $ translation ;
95+
8696 return $ translation ;
8797 }
8898 }
@@ -93,6 +103,7 @@ public function getTranslation($language = null)
93103 $ translation = new $ class ();
94104 $ translation ->setAttribute ($ this ->translationLanguageAttribute , $ language );
95105 $ translations [] = $ translation ;
106+ $ this ->relationsBuffer = $ translations ;
96107 $ this ->owner ->populateRelation ($ this ->translationRelation , $ translations );
97108
98109 return $ translation ;
You can’t perform that action at this time.
0 commit comments