public static function buildContainer($rootPath) { $container = new self(); $container->addCompilerPass(new RouterTagCompilerPass()); $container->setProxyInstantiator(new RuntimeInstantiator()); $container->setParameter('app_root', $rootPath); $loader = new YamlFileLoader($container, new FileLocator($rootPath . '/config')); $loader->load('services.yml'); $container->compile(); return $container; }