Commit 6be92a5b authored by Baudouin Feildel's avatar Baudouin Feildel
Browse files

Add findByUserAndPath to UserPermissionRepository

parent 302d0546
......@@ -2,6 +2,7 @@
namespace App\Repository;
use App\Entity\User;
use App\Entity\UserPermission;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;
......@@ -25,4 +26,18 @@ class UserPermissionRepository extends ServiceEntityRepository
;
}
*/
/**
* @param User $user
* @param string $path
* @return null|UserPermission|UserPermission[]
*/
public function findByUserAndPath(User $user, string $path) {
return $this->createQueryBuilder('p')
->where('p.user = :user')->setParameter('user', $user)
->andWhere('p.path = :path')->setParameter('path', $path)
->getQuery()
->getResult()
;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment