Permalink
Browse files

Moved the EntityFactory to the bridge

  • Loading branch information...
1 parent caa105f commit 9653be618a72885fea2c93d45afab3f57226bcc2 @stof stof committed Dec 22, 2011
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Bundle\DoctrineBundle\DependencyInjection\Security\UserProvider;
+namespace Symfony\Bridge\Doctrine\DependencyInjection\Security\UserProvider;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
@@ -25,10 +25,19 @@
*/
class EntityFactory implements UserProviderFactoryInterface
{
+ private $key;
+ private $providerId;
+
+ public function __construct($key, $providerId)
+ {
+ $this->key = $key;
+ $this->providerId = $providerId;
+ }
+
public function create(ContainerBuilder $container, $id, $config)
{
$container
- ->setDefinition($id, new DefinitionDecorator('doctrine.orm.security.user.provider'))
+ ->setDefinition($id, new DefinitionDecorator($this->providerId))
->addArgument($config['class'])
->addArgument($config['property'])
->addArgument($config['manager_name'])
@@ -37,7 +46,7 @@ public function create(ContainerBuilder $container, $id, $config)
public function getKey()
{
- return 'entity';
+ return $this->key;
}
public function addConfiguration(NodeDefinition $node)
@@ -12,10 +12,10 @@
namespace Symfony\Bundle\DoctrineBundle;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
-use Symfony\Bundle\DoctrineBundle\DependencyInjection\Security\UserProvider\EntityFactory;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\DoctrineValidationPass;
+use Symfony\Bridge\Doctrine\DependencyInjection\Security\UserProvider\EntityFactory;
use Symfony\Bundle\DoctrineBundle\DependencyInjection\Compiler\RegisterEventListenersAndSubscribersPass;
/**
@@ -33,7 +33,7 @@ public function build(ContainerBuilder $container)
$container->addCompilerPass(new RegisterEventListenersAndSubscribersPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION);
if ($container->hasExtension('security')) {
- $container->getExtension('security')->addUserProviderFactory(new EntityFactory());
+ $container->getExtension('security')->addUserProviderFactory(new EntityFactory('entity', 'doctrine.orm.security.user.provider'));
}
$container->addCompilerPass(new DoctrineValidationPass('orm'));

0 comments on commit 9653be6

Please sign in to comment.