diff --git a/src/Symfony/Component/Security/Acl/Domain/Acl.php b/src/Symfony/Component/Security/Acl/Domain/Acl.php index 4a4a2e232b07..a890bbec0343 100644 --- a/src/Symfony/Component/Security/Acl/Domain/Acl.php +++ b/src/Symfony/Component/Security/Acl/Domain/Acl.php @@ -311,9 +311,9 @@ public function setEntriesInheriting($boolean) /** * {@inheritDoc} */ - public function setParentAcl(AclInterface $acl) + public function setParentAcl(AclInterface $acl = null) { - if (null === $acl->getId()) { + if (null !== $acl && null === $acl->getId()) { throw new \InvalidArgumentException('$acl must have an ID.'); } diff --git a/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php b/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php index 521d307839e4..a846a9f16182 100644 --- a/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php +++ b/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php @@ -114,9 +114,10 @@ function setEntriesInheriting($boolean); /** * Sets the parent ACL * - * @param AclInterface $acl + * @param AclInterface|null $acl + * @return void */ - function setParentAcl(AclInterface $acl); + function setParentAcl(AclInterface $acl = null); /** * Updates a class-based ACE diff --git a/tests/Symfony/Tests/Component/Security/Acl/Domain/AclTest.php b/tests/Symfony/Tests/Component/Security/Acl/Domain/AclTest.php index 762ce7693db1..90f13fb40489 100644 --- a/tests/Symfony/Tests/Component/Security/Acl/Domain/AclTest.php +++ b/tests/Symfony/Tests/Component/Security/Acl/Domain/AclTest.php @@ -250,6 +250,9 @@ public function testSetGetParentAcl() $this->assertNull($acl->getParentAcl()); $acl->setParentAcl($parentAcl); $this->assertSame($parentAcl, $acl->getParentAcl()); + + $acl->setParentAcl(null); + $this->assertNull($acl->getParentAcl()); } public function testSetIsEntriesInheriting()