diff --git a/UPGRADE-4.x.md b/UPGRADE-4.x.md index 25c51b7958..aec48626e7 100644 --- a/UPGRADE-4.x.md +++ b/UPGRADE-4.x.md @@ -1,6 +1,14 @@ UPGRADE 4.x =========== +UPGRADE FROM 4.18 to 4.19 +========================= + +## BCLabelTranslatorStrategy + +The BCLabelTranslatorStrategy is deprecated. Please use another label translator strategy or +implements your own directly in your project. + UPGRADE FROM 4.13 to 4.14 ========================= diff --git a/src/Resources/config/core.php b/src/Resources/config/core.php index 74a3dbb222..cec4752cf4 100644 --- a/src/Resources/config/core.php +++ b/src/Resources/config/core.php @@ -92,6 +92,7 @@ // Services used to format the label, default is sonata.admin.label.strategy.noop + // NEXT_MAJOR: Remove this line. ->set('sonata.admin.label.strategy.bc', BCLabelTranslatorStrategy::class) ->set('sonata.admin.label.strategy.native', NativeLabelTranslatorStrategy::class) diff --git a/src/Translator/BCLabelTranslatorStrategy.php b/src/Translator/BCLabelTranslatorStrategy.php index 4981c8c17e..29c43edffb 100644 --- a/src/Translator/BCLabelTranslatorStrategy.php +++ b/src/Translator/BCLabelTranslatorStrategy.php @@ -15,11 +15,21 @@ /** * @author Thomas Rabaix + * + * NEXT_MAJOR: Remove this class. + * + * @deprecated since sonata-project/admin-bundle 4.x, will be removed in 5.0. */ final class BCLabelTranslatorStrategy implements LabelTranslatorStrategyInterface { public function getLabel(string $label, string $context = '', string $type = ''): string { + @trigger_error(sprintf( + 'The "%s" class is deprecated since sonata-project/admin-bundle version 4.x and will be' + .' removed in 5.0 version.', + self::class + ), \E_USER_DEPRECATED); + if ('breadcrumb' === $context) { return sprintf('%s.%s_%s', $context, $type, strtolower($label)); } diff --git a/tests/Translator/BCLabelTranslatorStrategyTest.php b/tests/Translator/BCLabelTranslatorStrategyTest.php index 1c592212bc..e3d8b1512b 100644 --- a/tests/Translator/BCLabelTranslatorStrategyTest.php +++ b/tests/Translator/BCLabelTranslatorStrategyTest.php @@ -16,6 +16,11 @@ use PHPUnit\Framework\TestCase; use Sonata\AdminBundle\Translator\BCLabelTranslatorStrategy; +/** + * NEXT_MAJOR: Remove this class. + * + * @group legacy + */ final class BCLabelTranslatorStrategyTest extends TestCase { public function testLabel(): void