Skip to content

Instantly share code, notes, and snippets.

@pierredup
Created August 21, 2018 21:10
Show Gist options
  • Save pierredup/10e3c1a435bb11803aa5c759201ffb82 to your computer and use it in GitHub Desktop.
Save pierredup/10e3c1a435bb11803aa5c759201ffb82 to your computer and use it in GitHub Desktop.
Track class for changes to rebuilt container
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AppBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
// Any changes to the MyConfig class will trigger the container cache to be rebuilt
// Note: This only works when Symfony is in development mode
$container->addObjectResource(MyConfig::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment