merged branch dbu/security-dbal-listener-cleanup (PR #8521)

This PR was merged into the master branch.

Discussion
----------

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

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

following a discussion with @Stof on https://github.com/doctrine/DoctrinePHPCRBundle/pull/78 i thought to clean up the code i used as template as well.

Commits
-------

b960004 security acl dbal schema: inject the schema instead of the whole container
This commit is contained in:
Fabien Potencier 2013-07-19 12:33:09 +02:00
commit 9b861ef7b3
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" />