src/Models/Repository/PermissionRepository.php
public function getPermissionIdByName($permissionName)
    {
        $qb = $this->createQueryBuilder('permission');

        $result = $qb->select('permission.id')
            ->where($qb->expr()->eq('permission.name', $qb->expr()->literal($permissionName)))
            ->setMaxResults(1)
            ->getQuery()
            ->getArrayResult();

        if (count($result) > 0) {
            return $result[0]['id'];
        }

        return null;
    }
public function getPermissionIdByName($permissionName)
    {
        $qb = $this->createQueryBuilder('permission');

        $result = $qb->select('permission.id')
            ->where($qb->expr()->eq('permission.name', $qb->expr()->literal($permissionName)))
            ->setMaxResults(1)
            ->getQuery()
            ->getArrayResult();

        if (count($result) > 0) {
            return $result[0]['id'];
        }

        return null;
    }
public function getPermissionIdByName ( $ permissionName ) { $ qb = $ this -> createQueryBuilder ( 'permission' ) ; $ result = $ qb -> select ( 'permission.id' ) -> where ( $ qb -> expr ( ) -> eq ( 'permission.name' , $ qb -> expr ( ) -> literal ( $ permissionName ) ) ) -> setMaxResults ( 1 ) -> getQuery ( ) -> getArrayResult ( ) ; if ( count ( $ result ) > 0 ) { return $ result [ 0 ] [ 'id' ] ; } return null ; }
Finds permission by name. If it founded returns permission id
@param string $permissionName
@return integer
Finds permission by name . If it founded returns permission id