allow unsetting parentAcl on MutableAclInterface

This commit is contained in:
Toni Uebernickel 2012-01-18 18:00:58 +01:00
parent 916597eb29
commit dbd3a1bcc0
3 changed files with 8 additions and 4 deletions

View File

@ -311,9 +311,9 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
/**
* {@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.');
}

View File

@ -114,9 +114,10 @@ interface MutableAclInterface extends AclInterface
/**
* 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

View File

@ -250,6 +250,9 @@ class AclTest extends \PHPUnit_Framework_TestCase
$this->assertNull($acl->getParentAcl());
$acl->setParentAcl($parentAcl);
$this->assertSame($parentAcl, $acl->getParentAcl());
$acl->setParentAcl(null);
$this->assertNull($acl->getParentAcl());
}
public function testSetIsEntriesInheriting()