-
Notifications
You must be signed in to change notification settings - Fork 708
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 Flex (3.3) - Dependency with Twig #1772
Comments
Try adding
If you do not define exception controller and have TwigBundle enabled
|
@ramoshka I'm seeing this error with the following config: exception:
enabled: true
exception_controller: 'AppBundle\Port\Rest\RequestValidation\RequestValidationExceptionListener::render' It's on 3.4 though, should I open a new issue? |
I guess both issues have the same cause. So no need for a new issue IMO. |
Having the same issue with Symfony 4 and Flex. |
Check your bundles registration order. Try to load <?php
// bundles.php
return [
// ...
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
FOS\RestBundle\FOSRestBundle::class => ['all' => true],
]; It relates to the compiler pass: namespace FOS\RestBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Remove the 'fos_rest.exception.twig_controller' service if twig is enabled.
*
* @internal
*/
final class TwigExceptionPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->has('templating.engine.twig')) {
$container->removeDefinition('fos_rest.exception.twig_controller');
}
}
} If you really need to use
|
Given that the templating engine is no longer installed and enabled by default, why not modify the TwigExceptionPass to just check for the twig service instead of templating.engine.twig? Seem like it should still work. You lose the old style twig template path support but that should not be a problem. |
I have the same problem. Fix is available in #1945. Would be nice if it would get merged. |
When I want to enable exception handlers, I get the following exception :
The service "fos_rest.exception.twig_controller" has a dependency on a non-existent service "templating.engine.twig".
The text was updated successfully, but these errors were encountered: