add handling of parent ACL

* fix ObjectIdentityQuery::findGrandChildren
This commit is contained in:
Toni Uebernickel 2012-01-20 13:17:48 +01:00
commit 3524cd8a6b
5 changed files with 145 additions and 15 deletions

View file

@ -10,7 +10,9 @@
namespace Propel\PropelBundle\Model\Acl;
use Criteria;
use PropelPDO;
use PropelCollection;
use Propel\PropelBundle\Model\Acl\ObjectIdentity;
use Propel\PropelBundle\Model\Acl\om\BaseObjectIdentityQuery;
@ -56,4 +58,39 @@ class ObjectIdentityQuery extends BaseObjectIdentityQuery
->findOne($con)
;
}
/**
* Return all children of the given object identity.
*
* @param ObjectIdentity $objectIdentity
* @param PropelPDO $con
*
* @return PropelCollection
*/
public function findChildren(ObjectIdentity $objectIdentity, PropelPDO $con = null)
{
return $this
->filterByObjectIdentityRelatedByParentObjectIdentityId($objectIdentity)
->find($con)
;
}
/**
* Return all children and grand-children of the given object identity.
*
* @param ObjectIdentity $objectIdentity
* @param PropelPDO $con
*
* @return PropelCollection
*/
public function findGrandChildren(ObjectIdentity $objectIdentity, PropelPDO $con = null)
{
return $this
->useObjectIdentityAncestorRelatedByObjectIdentityIdQuery()
->filterByObjectIdentityRelatedByAncestorId($objectIdentity)
->filterByObjectIdentityRelatedByObjectIdentityId($objectIdentity, Criteria::NOT_EQUAL)
->endUse()
->find($con)
;
}
}