You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Main project requires a package which requires api-platform/metadata
Warning: Ambiguous class resolution,
"ApiPlatform\Metadata\Resource\Factory\CachedResourceMetadataCollectionFactory" was found 2x:
in "/xxxxx/vendor/api-platform/metadata/Resource/Factory/CachedResourceMetadataCollectionFactory.php"
and "/xxxxx/vendor/api-platform/core/src/Metadata/Resource/Factory/CachedResourceMetadataCollectionFactory.php",
the first will be used.
Possible resolution
Core package composer.json should have a replace section with all sub-packages splitted from core:
Hi, would you be able to check the v3.3.0-alpha.2? We removed these dependencies from the main composer.json.
I don't understand. Problem would be the same on v3.3.0-alpha.2.
If I create a project using api-pack, api-platform/core will be loaded into my project.
Then, if my project depends on a library that relies only on api-platform/metadata, my project will have coreandmetadata packages autoloaded.
There are 2 solutions :
api-platform/core composer.json declares a replace section, avoiding autoload any api-platform sub-packages
or api-platform/api-pack does not load api-platform/core but all single api-platform packages. Thus, api-platform/core would become a dev-only package. The same way my project does not rely on symfony/symfony package, but all symfony/** sub-packages.
Then, if my project depends on a library that relies only on api-platform/metadata, my project will have core and metadata packages autoloaded.
It should not have core at all.
or api-platform/api-pack does not load api-platform/core but all single api-platform packages. Thus, api-platform/core would become a dev-only package. The same way my project does not rely on symfony/symfony package, but all symfony/** sub-packages.
How to reproduce
api-platform/core
in main projectapi-platform/metadata
Possible resolution
Core package
composer.json
should have areplace
section with all sub-packages splitted from core:That way, if core is loaded, composer will not autoload any sub-package.
The text was updated successfully, but these errors were encountered: