src/Sulu/Bundle/SecurityBundle/Entity/RoleSettingRepository.php
public function findSetting($roleId, $key)
    {
        $queryBuilder = $this->createQueryBuilder('s')
            ->join('s.role', 'r')
            ->where('r.id = :roleId')
            ->andWhere('s.key = :key')
            ->setParameters(['roleId' => $roleId, 'key' => $key]);

        try {
            return $queryBuilder->getQuery()->getSingleResult();
        } catch (NoResultException $e) {
            return;
        }
    }
public function findSetting($roleId, $key)
    {
        $queryBuilder = $this->createQueryBuilder('s')
            ->join('s.role', 'r')
            ->where('r.id = :roleId')
            ->andWhere('s.key = :key')
            ->setParameters(['roleId' => $roleId, 'key' => $key]);

        try {
            return $queryBuilder->getQuery()->getSingleResult();
        } catch (NoResultException $e) {
            return;
        }
    }
public function findSetting ( $ roleId , $ key ) { $ queryBuilder = $ this -> createQueryBuilder ( 's' ) -> join ( 's.role' , 'r' ) -> where ( 'r.id = :roleId' ) -> andWhere ( 's.key = :key' ) -> setParameters ( [ 'roleId' => $ roleId , 'key' => $ key ] ) ; try { return $ queryBuilder -> getQuery ( ) -> getSingleResult ( ) ; } catch ( NoResultException $ e ) { return ; } }
Returns role-setting object.

@param int $roleId
@param string $key

@return RoleSettingInterface|null
Returns role - setting object .