Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CleverAgeProcessBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -36,5 +37,7 @@ public function build(ContainerBuilder $container): void
'addTransformer'
)
);

$container->addCompilerPass(new CheckSerializerCompilerPass());
}
}
36 changes: 36 additions & 0 deletions DependencyInjection/Compiler/CheckSerializerCompilerPass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php declare(strict_types=1);
/*
* This file is part of the CleverAge/ProcessBundle package.
*
* Copyright (C) 2017-2019 Clever-Age
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CleverAge\ProcessBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\AutowiringFailedException;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;

/**
* Check the presence of the serializer (required for this bundle), and help the user to set it
*
* @author Valentin Clavreul <vclavreul@clever-age.com>
*/
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);
}
}
}
2 changes: 2 additions & 0 deletions Documentation/01-quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down