|
100 | 100 | use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; |
101 | 101 | use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
102 | 102 | use Symfony\Component\HttpKernel\Log\DebugLoggerConfigurator; |
103 | | -use Symfony\Component\JsonEncoder\Attribute\JsonEncodable; |
104 | | -use Symfony\Component\JsonEncoder\DecoderInterface as JsonEncoderDecoderInterface; |
105 | | -use Symfony\Component\JsonEncoder\EncoderInterface as JsonEncoderEncoderInterface; |
106 | | -use Symfony\Component\JsonEncoder\JsonEncoder; |
107 | | -use Symfony\Component\JsonEncoder\ValueTransformer\ValueTransformerInterface; |
| 103 | +use Symfony\Component\JsonStreamer\Attribute\JsonStreamable; |
| 104 | +use Symfony\Component\JsonStreamer\JsonStreamWriter; |
| 105 | +use Symfony\Component\JsonStreamer\StreamReaderInterface; |
| 106 | +use Symfony\Component\JsonStreamer\StreamWriterInterface; |
| 107 | +use Symfony\Component\JsonStreamer\ValueTransformer\ValueTransformerInterface; |
108 | 108 | use Symfony\Component\Lock\LockFactory; |
109 | 109 | use Symfony\Component\Lock\LockInterface; |
110 | 110 | use Symfony\Component\Lock\PersistingStoreInterface; |
@@ -436,12 +436,12 @@ public function load(array $configs, ContainerBuilder $container): void |
436 | 436 | $this->registerPropertyInfoConfiguration($config['property_info'], $container, $loader); |
437 | 437 | } |
438 | 438 |
|
439 | | - if ($this->readConfigEnabled('json_encoder', $container, $config['json_encoder'])) { |
| 439 | + if ($this->readConfigEnabled('json_streamer', $container, $config['json_streamer'])) { |
440 | 440 | if (!$typeInfoEnabled) { |
441 | | - throw new LogicException('JsonEncoder support cannot be enabled as the TypeInfo component is not '.(interface_exists(TypeResolverInterface::class) ? 'enabled.' : 'installed. Try running "composer require symfony/type-info".')); |
| 441 | + throw new LogicException('JsonStreamer support cannot be enabled as the TypeInfo component is not '.(interface_exists(TypeResolverInterface::class) ? 'enabled.' : 'installed. Try running "composer require symfony/type-info".')); |
442 | 442 | } |
443 | 443 |
|
444 | | - $this->registerJsonEncoderConfiguration($config['json_encoder'], $container, $loader); |
| 444 | + $this->registerJsonStreamerConfiguration($config['json_streamer'], $container, $loader); |
445 | 445 | } |
446 | 446 |
|
447 | 447 | if ($this->readConfigEnabled('lock', $container, $config['lock'])) { |
@@ -755,8 +755,8 @@ static function (ChildDefinition $definition, AsPeriodicTask|AsCronTask $attribu |
755 | 755 | } |
756 | 756 | ); |
757 | 757 | } |
758 | | - $container->registerAttributeForAutoconfiguration(JsonEncodable::class, static function (ChildDefinition $definition, JsonEncodable $attribute): void { |
759 | | - $definition->addTag('json_encoder.encodable', [ |
| 758 | + $container->registerAttributeForAutoconfiguration(JsonStreamable::class, static function (ChildDefinition $definition, JsonStreamable $attribute): void { |
| 759 | + $definition->addTag('json_streamer.streamable', [ |
760 | 760 | 'object' => $attribute->asObject, |
761 | 761 | 'list' => $attribute->asList, |
762 | 762 | ]); |
@@ -2033,26 +2033,26 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder |
2033 | 2033 | $container->setParameter('.serializer.named_serializers', $config['named_serializers'] ?? []); |
2034 | 2034 | } |
2035 | 2035 |
|
2036 | | - private function registerJsonEncoderConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader): void |
| 2036 | + private function registerJsonStreamerConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader): void |
2037 | 2037 | { |
2038 | | - if (!class_exists(JsonEncoder::class)) { |
2039 | | - throw new LogicException('JsonEncoder support cannot be enabled as the JsonEncoder component is not installed. Try running "composer require symfony/json-encoder".'); |
| 2038 | + if (!class_exists(JsonStreamWriter::class)) { |
| 2039 | + throw new LogicException('JsonStreamer support cannot be enabled as the JsonStreamer component is not installed. Try running "composer require symfony/json-streamer".'); |
2040 | 2040 | } |
2041 | 2041 |
|
2042 | 2042 | $container->registerForAutoconfiguration(ValueTransformerInterface::class) |
2043 | | - ->addTag('json_encoder.value_transformer'); |
| 2043 | + ->addTag('json_streamer.value_transformer'); |
2044 | 2044 |
|
2045 | | - $loader->load('json_encoder.php'); |
| 2045 | + $loader->load('json_streamer.php'); |
2046 | 2046 |
|
2047 | | - $container->registerAliasForArgument('json_encoder.encoder', JsonEncoderEncoderInterface::class, 'json.encoder'); |
2048 | | - $container->registerAliasForArgument('json_encoder.decoder', JsonEncoderDecoderInterface::class, 'json.decoder'); |
| 2047 | + $container->registerAliasForArgument('json_streamer.stream_writer', StreamWriterInterface::class, 'json.stream_writer'); |
| 2048 | + $container->registerAliasForArgument('json_streamer.stream_reader', StreamReaderInterface::class, 'json.stream_reader'); |
2049 | 2049 |
|
2050 | | - $container->setParameter('.json_encoder.encoders_dir', '%kernel.cache_dir%/json_encoder/encoder'); |
2051 | | - $container->setParameter('.json_encoder.decoders_dir', '%kernel.cache_dir%/json_encoder/decoder'); |
2052 | | - $container->setParameter('.json_encoder.lazy_ghosts_dir', '%kernel.cache_dir%/json_encoder/lazy_ghost'); |
| 2050 | + $container->setParameter('.json_streamer.stream_writers_dir', '%kernel.cache_dir%/json_streamer/stream_writer'); |
| 2051 | + $container->setParameter('.json_streamer.stream_readers_dir', '%kernel.cache_dir%/json_streamer/stream_reader'); |
| 2052 | + $container->setParameter('.json_streamer.lazy_ghosts_dir', '%kernel.cache_dir%/json_streamer/lazy_ghost'); |
2053 | 2053 |
|
2054 | 2054 | if (\PHP_VERSION_ID >= 80400) { |
2055 | | - $container->removeDefinition('.json_encoder.cache_warmer.lazy_ghost'); |
| 2055 | + $container->removeDefinition('.json_streamer.cache_warmer.lazy_ghost'); |
2056 | 2056 | } |
2057 | 2057 | } |
2058 | 2058 |
|
|
0 commit comments