Skip to content

Instantly share code, notes, and snippets.

@Neirda24
Created November 29, 2018 14:31
Show Gist options
  • Save Neirda24/7e087f58102bd5955479ca81241addea to your computer and use it in GitHub Desktop.
Save Neirda24/7e087f58102bd5955479ca81241addea to your computer and use it in GitHub Desktop.
Override service with CompilerPass
<?php
class OverrideFosRestServicesPass implements CompilerPassInterface
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
if ($container->hasDefinition('fos_rest.exception_listener')) {
$container
->getDefinition('fos_rest.exception_listener')
->setClass(ExceptionSubscriber::class)
;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment