2017 © Pedro Peláez
 

symfony-bundle acldoctrinequery-bundle

Symfony2 Helper Bundle for ACL

image

kos4live/acldoctrinequery-bundle

Symfony2 Helper Bundle for ACL

  • Friday, July 26, 2013
  • by kos4live
  • Repository
  • 1 Watchers
  • 1 Stars
  • 118 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

AclDoctrineQueryBundle

Helper Bundle for Symfony2 ACL, (*1)

Usage:

$aclQueryHelper = $this->get('kos4live.acl_doctrine_query.helper');
$em = $this->getDoctrine()->getManager();
$qb = $em->createQueryBuilder();

$qb = $qb->select('p')
    ->from('Entity\Product', 'p');
$qb->setMaxResults(10);

$permissions = array('view');
$user = $this->getUser();

// The returned query object is a clone, you can alway use $qb->getQuery() to get the original query object
$query = $aqlQueryHelper->apply($qb, $permissions, $user);

$result = $query->getArrayResult();

The $user parameter of apply() is optional and if is not set or null, the securityContext would use to determine the current user., (*2)

Don't forget add to AppKernel.php new kos4live\AclDoctrineQueryBundle\kos4liveAclDoctrineQueryBundle(),, (*3)

The Versions