[DoctrineBundle] removed the need to pass the container to the extension (which is dangerous)
This commit is contained in:
parent
635135a4e0
commit
3fbe294461
@ -28,7 +28,7 @@ class Bundle extends BaseBundle
|
||||
{
|
||||
public function buildContainer(ContainerInterface $container)
|
||||
{
|
||||
Loader::registerExtension(new DoctrineExtension($container));
|
||||
Loader::registerExtension(new DoctrineExtension($container->getParameter('kernel.bundle_dirs'), $container->getParameter('kernel.bundles')));
|
||||
|
||||
$metadataDirs = array();
|
||||
$entityDirs = array();
|
||||
|
@ -7,7 +7,6 @@ use Symfony\Components\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Components\DependencyInjection\BuilderConfiguration;
|
||||
use Symfony\Components\DependencyInjection\Definition;
|
||||
use Symfony\Components\DependencyInjection\Reference;
|
||||
use Symfony\Components\DependencyInjection\Container;
|
||||
|
||||
/*
|
||||
* This file is part of the symfony framework.
|
||||
@ -33,10 +32,13 @@ class DoctrineExtension extends LoaderExtension
|
||||
);
|
||||
|
||||
protected $alias;
|
||||
protected $bundleDirs;
|
||||
protected $bundles;
|
||||
|
||||
public function __construct(Container $container)
|
||||
public function __construct(array $bundleDirs, array $bundles)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->bundleDirs = $bundleDirs;
|
||||
$this->bundles = $bundles;
|
||||
}
|
||||
|
||||
public function setAlias($alias)
|
||||
@ -197,8 +199,8 @@ class DoctrineExtension extends LoaderExtension
|
||||
// configure metadata driver for each bundle based on the type of mapping files found
|
||||
$mappingDriverDef = new Definition('Doctrine\ORM\Mapping\Driver\DriverChain');
|
||||
$bundleEntityMappings = array();
|
||||
$bundleDirs = $this->container->getParameter('kernel.bundle_dirs');
|
||||
foreach ($this->container->getParameter('kernel.bundles') as $className)
|
||||
$bundleDirs = $this->bundleDirs;
|
||||
foreach ($this->bundles as $className)
|
||||
{
|
||||
$tmp = dirname(str_replace('\\', '/', $className));
|
||||
$namespace = str_replace('/', '\\', dirname($tmp));
|
||||
|
Reference in New Issue
Block a user