-
-
Notifications
You must be signed in to change notification settings - Fork 923
Open
Labels
Description
Description
Bundle configuration does not check if required package is installed before configuring associated services.
Example
In ApiPlatform\Symfony\Bundle\DependencyInjection\ApiPlatformExtension.php, we will configure the availble formats. If we try to configure the format jsonhal:
api_platform:
title: Hello API Platform
version: 1.0.0
formats:
jsonld: [ "application/ld+json" ]
jsonhal: [ "application/hal+json" ]
An exception is thrown saying "Invalid service "api_platform.hal.normalizer.entrypoint": class "ApiPlatform\Hal\Serializer\EntrypointNormalizer" does not exist".
Proposal
In ApiPlatform\Symfony\Bundle\DependencyInjection\ApiPlatformExtension.php, check for required libraries associated with specific configuration.
In the previous example, error message could be "Trying to configure jsonhal format, but required package api-platform/json-hal is not installed"
soyuka