samuel4x4/acldoctrinequery-bundle
最新稳定版本:1.0.3
Composer 安装命令:
composer require samuel4x4/acldoctrinequery-bundle
包简介
Symfony2 Helper Bundle for ACLs
README 文档
README
Helper Bundle for Symfony2 ACL
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.
Don't forget add to AppKernel.php new kos4live\AclDoctrineQueryBundle\kos4liveAclDoctrineQueryBundle(),
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-10-21