security acl dbal schema: inject the schema instead of the whole container

This commit is contained in:
David Buchmann 2013-07-18 14:31:55 +02:00
parent 76b6449c16
commit b960004993
2 changed files with 6 additions and 6 deletions

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\SecurityBundle\EventListener;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Security\Acl\Dbal\Schema;
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
/**
@ -21,16 +21,16 @@ use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
*/
class AclSchemaListener
{
private $container;
private $schema;
public function __construct(ContainerInterface $container)
public function __construct(Schema $schema)
{
$this->container = $container;
$this->schema = $schema;
}
public function postGenerateSchema(GenerateSchemaEventArgs $args)
{
$schema = $args->getSchema();
$this->container->get('security.acl.dbal.schema')->addToSchema($schema);
$this->schema->addToSchema($schema);
}
}

View File

@ -37,7 +37,7 @@
<argument type="service" id="security.acl.dbal.connection" />
</service>
<service id="security.acl.dbal.schema_listener" class="%security.acl.dbal.schema_listener.class%" public="false">
<argument type="service" id="service_container" />
<argument type="service" id="security.acl.dbal.schema" />
</service>
<service id="security.acl.provider" alias="security.acl.dbal.provider" />