Skip to content

Commit 8844ae9

Browse files
committed
Fixes a regression introduced in 1.1.1
1 parent 6013a80 commit 8844ae9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/ACL.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function rebuildAuthorizations()
164164
$roleRepository = $this->entityManager->getRepository('MyCLabs\ACL\Model\Role');
165165

166166
// Clear
167-
$this->entityManager->createQuery('DELETE MyCLabs\ACL\Model\Authorization');
167+
$this->entityManager->createQuery('DELETE MyCLabs\ACL\Model\Authorization')->execute();
168168
$this->entityManager->clear('MyCLabs\ACL\Model\Authorization');
169169

170170
// Regenerate

tests/Integration/RebuildAuthorizationsTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,20 @@ public function testRebuildAuthorizations()
2727

2828
$this->em->clear();
2929

30+
$qb = $this->em->createQueryBuilder();
31+
$qb->select('count(authorization.id)');
32+
$qb->from('MyCLabs\ACL\Model\Authorization', 'authorization');
33+
$query = $qb->getQuery();
34+
35+
$initialCount = $query->getSingleScalarResult();
36+
3037
$this->acl->rebuildAuthorizations();
3138

3239
$this->assertFalse($this->acl->isAllowed($user, Actions::VIEW, $article1));
3340
$this->assertFalse($this->acl->isAllowed($user, Actions::EDIT, $article1));
3441
$this->assertTrue($this->acl->isAllowed($user, Actions::VIEW, $article2));
3542
$this->assertTrue($this->acl->isAllowed($user, Actions::EDIT, $article2));
43+
44+
$this->assertEquals($initialCount, $query->getSingleScalarResult());
3645
}
3746
}

0 commit comments

Comments
 (0)