Skip to content

Commit ffbcc23

Browse files
committed
[BUGFIX] Respect correct namespace for used b13/container class
`b13/container` moved a class with v2.1.0 to another namespace. We instantiated and called that class to re-run code in xclassed class which both extensions needs to xclass and combine both tasks. This change now checks for both possible classes and use the correct ones. Using kind of package or composer information is not reliable enough and more complex than the chosen `class_exist` check. The newer namespace is checked first, in case the container extensions adds a class_alias for the old one. Directly using the new class if existing is the better way. See: b13/container@5d57961#diff-1b5dddc7fdc72ce709fe89a91a8873332a6f6755209043cb81c3b116ee70f738 Resolves: #276
1 parent 64aa19e commit ffbcc23

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Classes/Override/LocalizationController.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,16 @@ public function getRecordLocalizeSummary(ServerRequestInterface $request): Respo
179179
// s. EXT:containers Xclass B13\Container\Xclasses\LocalizationController
180180
if (
181181
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('container')
182-
&& class_exists(\B13\Container\Xclasses\RecordLocalizeSummaryModifier::class)
183182
) {
184-
$recordLocalizeSummaryModifier = GeneralUtility::makeInstance(\B13\Container\Xclasses\RecordLocalizeSummaryModifier::class);
185-
$payloadBody = $recordLocalizeSummaryModifier->rebuildPayload($payloadBody);
183+
if (class_exists(\B13\Container\Service\RecordLocalizeSummaryModifier::class)) {
184+
// since b13/container 2.1.0
185+
$recordLocalizeSummaryModifier = GeneralUtility::makeInstance(\B13\Container\Service\RecordLocalizeSummaryModifier::class);
186+
$payloadBody = $recordLocalizeSummaryModifier->rebuildPayload($payloadBody);
187+
} elseif (class_exists(\B13\Container\Xclasses\RecordLocalizeSummaryModifier::class)) {
188+
// before b13/container 2.1.0
189+
$recordLocalizeSummaryModifier = GeneralUtility::makeInstance(\B13\Container\Xclasses\RecordLocalizeSummaryModifier::class);
190+
$payloadBody = $recordLocalizeSummaryModifier->rebuildPayload($payloadBody);
191+
}
186192
}
187193

188194
return (new JsonResponse())->setPayload($payloadBody);

0 commit comments

Comments
 (0)