Skip to content

Instantly share code, notes, and snippets.

@caefer
Created March 23, 2011 13:47
Show Gist options
  • Select an option

  • Save caefer/883103 to your computer and use it in GitHub Desktop.

Select an option

Save caefer/883103 to your computer and use it in GitHub Desktop.
<?php
namespace MyProject\MyBundle\DependencyInjection;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class MyExtension extends Extension
{
public function load(array $config, ContainerBuilder $container)
{
if (!$container->hasDefinition('my'))
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('my.xml');
}
}
public function getAlias()
{
return 'my';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment