diff --git a/CHANGELOG.md b/CHANGELOG.md index bb62a2ea..642560dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [GH#114](https://github.com/jolicode/automapper/pull/114) Introducing Mapper Attribute - [GH#117](https://github.com/jolicode/automapper/pull/117) Allow multiple source/target, allow overriding attribute with priority system +### Changed +- [GH#119](https://github.com/jolicode/automapper/pull/119) Change serializer configuration naming in Symfony Bundle + ### Fixed - [GH#109](https://github.com/jolicode/automapper/pull/109) Use AutoMapper exceptions - [GH#115](https://github.com/jolicode/automapper/pull/115) Fix generating discriminator dependencies diff --git a/docs/bundle/configuration.md b/docs/bundle/configuration.md index 5b431355..3c02eb34 100644 --- a/docs/bundle/configuration.md +++ b/docs/bundle/configuration.md @@ -67,9 +67,9 @@ automapper: * `always` will generate the mappers at each request; * `never` will generate them only if they don't exist; * `on_change` will generate the mappers only if the source or target class has changed since the last generation; -* `serializer` (default: `true` if the symfony/serializer is available, false otherwise): A boolean which indicate - if we use the attribute of the symfony/serializer during the mapping, this only apply to the `#[Groups]`, `#[MaxDepth]`, - `#[Ignore]` and `#[DiscriminatorMap]` attributes; +* `serializer_attributes` (default: `true` if the symfony/serializer is available, false otherwise): A boolean which +indicate if we use the attribute of the symfony/serializer during the mapping, this only apply to the `#[Groups]`, +`#[MaxDepth]`, `#[Ignore]` and `#[DiscriminatorMap]` attributes; * `api_platform` (default: `false`): A boolean which indicate if we use services from the api-platform/core package and inject extra data (json ld) in the mappers when we map a Resource class to or from an array. * `name_converter` (default: `null`): A service id which implement the `AdvancedNameConverterInterface` from the symfony/serializer, diff --git a/docs/bundle/migrate.md b/docs/bundle/migrate.md index 108f8cdd..079d735e 100644 --- a/docs/bundle/migrate.md +++ b/docs/bundle/migrate.md @@ -57,7 +57,7 @@ automapper: ### Serializer attributes -If you have serializer attributes on your entity, you can also enabled the `serializer` option to use them. +If you have serializer attributes on your entity, you can also enabled the `serializer_attributes` option to use them. ```yaml # config/packages/automapper.yaml diff --git a/src/Symfony/Bundle/DependencyInjection/AutoMapperExtension.php b/src/Symfony/Bundle/DependencyInjection/AutoMapperExtension.php index 364a32af..430f236c 100644 --- a/src/Symfony/Bundle/DependencyInjection/AutoMapperExtension.php +++ b/src/Symfony/Bundle/DependencyInjection/AutoMapperExtension.php @@ -95,7 +95,7 @@ public function load(array $configs, ContainerBuilder $container): void ->addTag('automapper.transformer_factory', ['priority' => '-1004']); } - if ($config['serializer']) { + if ($config['serializer_attributes']) { if (!interface_exists(SerializerInterface::class)) { throw new LogicException('The "symfony/serializer" component is required to use the "serializer" feature.'); } diff --git a/src/Symfony/Bundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/DependencyInjection/Configuration.php index f29d3eb3..28f9de57 100644 --- a/src/Symfony/Bundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/DependencyInjection/Configuration.php @@ -40,7 +40,7 @@ public function getConfigTreeBuilder(): TreeBuilder ->end() ->addDefaultsIfNotSet() ->end() - ->booleanNode('serializer')->defaultValue(interface_exists(SerializerInterface::class))->end() + ->booleanNode('serializer_attributes')->defaultValue(interface_exists(SerializerInterface::class))->end() ->booleanNode('api_platform')->defaultFalse()->end() ->scalarNode('name_converter')->defaultNull()->end() ->arrayNode('loader')