|
70 | 70 | use PHPStan\PhpDocParser\Parser\PhpDocParser; |
71 | 71 | use Ramsey\Uuid\Uuid; |
72 | 72 | use Symfony\AI\McpBundle\McpBundle; |
73 | | -use Symfony\Bundle\FrameworkBundle\Command\TranslationExtractCommand; |
| 73 | +use Symfony\Bundle\FrameworkBundle\Command\TranslationExtractCommand as FrameworkTranslationExtractCommand; |
74 | 74 | use Symfony\Bundle\FrameworkBundle\Controller\ControllerHelper; |
75 | 75 | use Symfony\Component\Config\FileLocator; |
76 | 76 | use Symfony\Component\Config\Resource\DirectoryResource; |
|
89 | 89 | use Symfony\Component\ObjectMapper\ObjectMapperInterface; |
90 | 90 | use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter; |
91 | 91 | use Symfony\Component\Serializer\Normalizer\NumberNormalizer; |
| 92 | +use Symfony\Component\Translation\Command\TranslationExtractCommand; |
92 | 93 | use Symfony\Component\Uid\AbstractUid; |
93 | 94 | use Symfony\Component\Validator\Validator\ValidatorInterface; |
94 | 95 | use Symfony\Component\Yaml\Yaml; |
@@ -210,9 +211,10 @@ public function load(array $configs, ContainerBuilder $container): void |
210 | 211 | $this->registerJsonStreamerConfiguration($container, $loader, $formats, $config); |
211 | 212 |
|
212 | 213 | // TranslationExtractCommand was introduced in framework-bundle/7.3 with the object mapper service. |
| 214 | + // Prefer its new namespace on Symfony 8.2 to avoid loading the deprecated FrameworkBundle shim. |
213 | 215 | // willBeAvailable mirrors FrameworkBundle's own gate: when symfony/object-mapper is in dev-only, |
214 | 216 | // FrameworkBundle skips object_mapper.php and the "object_mapper" service we alias to does not exist. |
215 | | - if (class_exists(ObjectMapper::class) && class_exists(TranslationExtractCommand::class) && ContainerBuilder::willBeAvailable('symfony/object-mapper', ObjectMapperInterface::class, ['symfony/framework-bundle'])) { |
| 217 | + if (class_exists(ObjectMapper::class) && (class_exists(TranslationExtractCommand::class) || class_exists(FrameworkTranslationExtractCommand::class)) && ContainerBuilder::willBeAvailable('symfony/object-mapper', ObjectMapperInterface::class, ['symfony/framework-bundle'])) { |
216 | 218 | $loader->load('state/object_mapper.php'); |
217 | 219 | $loader->load($config['use_symfony_listeners'] ? 'symfony/object_mapper.php' : 'state/object_mapper_processor.php'); |
218 | 220 | } |
|
0 commit comments