diff --git a/CleverAgeProcessBundle.php b/CleverAgeProcessBundle.php index b325c6d4..d6b35630 100644 --- a/CleverAgeProcessBundle.php +++ b/CleverAgeProcessBundle.php @@ -10,6 +10,7 @@ namespace CleverAge\ProcessBundle; +use CleverAge\ProcessBundle\DependencyInjection\Compiler\CheckSerializerCompilerPass; use CleverAge\ProcessBundle\DependencyInjection\Compiler\RegistryCompilerPass; use CleverAge\ProcessBundle\Registry\TransformerRegistry; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -36,5 +37,7 @@ public function build(ContainerBuilder $container): void 'addTransformer' ) ); + + $container->addCompilerPass(new CheckSerializerCompilerPass()); } } diff --git a/DependencyInjection/Compiler/CheckSerializerCompilerPass.php b/DependencyInjection/Compiler/CheckSerializerCompilerPass.php new file mode 100644 index 00000000..b7633f2d --- /dev/null +++ b/DependencyInjection/Compiler/CheckSerializerCompilerPass.php @@ -0,0 +1,36 @@ + + */ +class CheckSerializerCompilerPass implements CompilerPassInterface +{ + const MSG = 'The Symfony serializer component do not seem enabled, consider toggling framework.serializer.enable (see https://symfony.com/doc/current/reference/configuration/framework.html#reference-serializer-enabled)'; + + /** + * {@inheritDoc} + */ + public function process(ContainerBuilder $container) + { + if (!$container->has('serializer') && !$container->has(DenormalizerInterface::class)) { + throw new AutowiringFailedException('serializer', self::MSG); + } + } +} diff --git a/Documentation/01-quick_start.md b/Documentation/01-quick_start.md index 5e36b390..fe7094ce 100644 --- a/Documentation/01-quick_start.md +++ b/Documentation/01-quick_start.md @@ -24,6 +24,8 @@ This bundle requires Symfony 3. You can install it using composer: composer require cleverage/process-bundle ``` +This bundle requires the Symfony Serializer Component, but it might be disabled by default. Consider enable it with https://symfony.com/doc/current/reference/configuration/framework.html#reference-serializer-enabled. + ## Process definition Most of the work is done through the bundle configuration.