Moved the EntityFactory to the bridge
This commit is contained in:
parent
caa105fef9
commit
9653be618a
@ -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 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
*/
|
||||
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 @@ class EntityFactory implements UserProviderFactoryInterface
|
||||
|
||||
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 @@ class DoctrineBundle extends Bundle
|
||||
$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'));
|
||||
|
Reference in New Issue
Block a user