Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symfony AutoMapperBundle requires symfony/serializer and symfony/property-access #127

Closed
GromNaN opened this issue May 13, 2024 · 2 comments

Comments

@GromNaN
Copy link
Contributor

GromNaN commented May 13, 2024

On a fresh installation of Symfony 7.1, once AutoMapperBundle (version 9.0.1) is enabled in config/bundles.php, I get this error:

The service automapper.mapping.class_discriminator_from_class_metadata has a dependency on a non-existent service serializer.mapping.class_metadata_factory.

After installing the symfony/serializer package so that the service is registered by the FrameworkBundle, I get a new error:

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] You have requested a non-existent service serializer.normalizer.object.

This is solved by installing symfony/property-access. But then:

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] The service automapper.property_info.cache.inner has a dependency on a non-existent service property_info.phpstan_extractor.

This is solved by installing both phpstan/phpdoc-parser and phpdocumentor/type-resolver.

So I need to install this packages to work with the bundle:

composer require symfony/serializer symfony/property-access phpstan/phpdoc-parser phpdocumentor/type-resolver

This is the first time I install the package, so I'm not sure this is correct.

I think the installation of these dependencies could be better guided in the docs.

@Korbeil
Copy link
Member

Korbeil commented May 14, 2024

You are correct ! And we shouldn't force users to install Symfony's Serializer since it's now optional, I'll try to fix this.

Korbeil added a commit that referenced this issue May 14, 2024
Because they are required to make AutoMapper works, no reason not to put
them.

Will fix a part of #127,
but not everything.
Korbeil added a commit that referenced this issue May 14, 2024
`symfony/serializer` should not be required when installing AutoMapper,
so with this PR I make the `ClassDiscriminatorResolver` optional within
the bundle so we can install it without the Serializer installed.

Will fix a part of #127, but not everything.
@Korbeil
Copy link
Member

Korbeil commented May 14, 2024

Fixed thanks to #131 & #130

@Korbeil Korbeil closed this as completed May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants