@@ -155,6 +155,11 @@ class Record implements RecordInterface
155155 */
156156 protected $ configContainer ;
157157
158+ /**
159+ * @var RecordInterface[]
160+ */
161+ protected $ translatedRecords = [];
162+
158163 /**
159164 * @param string $tableName
160165 * @param array $localProperties
@@ -272,6 +277,11 @@ public function getStateRecursive(array &$alreadyVisited = []): string
272277 }
273278 $ alreadyVisited [$ this ->tableName ][] = $ this ->getIdentifier ();
274279 if (!$ this ->isChanged ()) {
280+ foreach ($ this ->getTranslatedRecords () as $ translatedRecord ) {
281+ if ($ translatedRecord ->isChangedRecursive ($ alreadyVisited )) {
282+ return static ::RECORD_STATE_CHANGED ;
283+ }
284+ }
275285 foreach ($ this ->getRelatedRecords () as $ tableName => $ relatedRecords ) {
276286 if ($ tableName === 'pages ' ) {
277287 continue ;
@@ -565,6 +575,23 @@ public function getRelatedRecords(): array
565575 return $ this ->relatedRecords ;
566576 }
567577
578+ /**
579+ * @return RecordInterface[]
580+ */
581+ public function getTranslatedRecords (): array
582+ {
583+ return $ this ->translatedRecords ;
584+ }
585+
586+ /**
587+ * @param RecordInterface $record
588+ * @return void
589+ */
590+ public function addTranslatedRecord (RecordInterface $ record ): void
591+ {
592+ $ this ->translatedRecords [$ record ->getIdentifier ()] = $ record ;
593+ }
594+
568595 /**
569596 * NOTICE: This will not work if debug.disableParentRecords is disabled!
570597 *
@@ -1206,4 +1233,17 @@ public function isTranslation(): bool
12061233 && array_key_exists ($ languageField , $ this ->localProperties )
12071234 && $ this ->localProperties [$ languageField ] > 0 ;
12081235 }
1236+
1237+ public function getRecordLanguage (): int
1238+ {
1239+ $ language = 0 ;
1240+
1241+ $ tcaService = GeneralUtility::makeInstance (TcaService::class);
1242+ $ languageField = $ tcaService ->getLanguageField ($ this ->tableName );
1243+ if (!empty ($ languageField ) && array_key_exists ($ languageField , $ this ->localProperties )) {
1244+ $ language = $ this ->localProperties [$ languageField ];
1245+ }
1246+
1247+ return $ language ;
1248+ }
12091249}
0 commit comments