public function findOneByRole($role)
    {
        $qb = $this->createQueryBuilder('g');

        return $qb
            ->andWhere($qb->expr()->like('g.roles', $qb->expr()->literal('%"'.strtoupper($role).'"%')))
            ->orderBy('g.position', 'DESC')
            ->setMaxResults(1)
            ->getQuery()
            ->getOneOrNullResult()
        ;
    }
public function findOneByRole($role)
    {
        $qb = $this->createQueryBuilder('g');

        return $qb
            ->andWhere($qb->expr()->like('g.roles', $qb->expr()->literal('%"'.strtoupper($role).'"%')))
            ->orderBy('g.position', 'DESC')
            ->setMaxResults(1)
            ->getQuery()
            ->getOneOrNullResult()
        ;
    }
public function findOneByRole ( $ role ) { $ qb = $ this -> createQueryBuilder ( 'g' ) ; return $ qb -> andWhere ( $ qb -> expr ( ) -> like ( 'g.roles' , $ qb -> expr ( ) -> literal ( '%"' . strtoupper ( $ role ) . '"%' ) ) ) -> orderBy ( 'g.position' , 'DESC' ) -> setMaxResults ( 1 ) -> getQuery ( ) -> getOneOrNullResult ( ) ; }
Finds the lower privilege level group having the given role.

@param string $role
@return GroupInterface|null
@throws \Doctrine\ORM\NonUniqueResultException
Finds the lower privilege level group having the given role .