Skip to content

Commit

Permalink
[DoctrineBundle] removed the need to pass the container to the extens…
Browse files Browse the repository at this point in the history
…ion (which is dangerous)
  • Loading branch information
fabpot committed Mar 1, 2010
1 parent 635135a commit 3fbe294
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Framework/DoctrineBundle/Bundle.php
Expand Up @@ -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();
Expand Down
Expand Up @@ -7,7 +7,6 @@
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.
Expand All @@ -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)
Expand Down Expand Up @@ -197,8 +199,8 @@ public function ormLoad($config)
// 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));
Expand Down

0 comments on commit 3fbe294

Please sign in to comment.