<?php

namespace App\Repository;

use App\Entity\WebrootRole;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

/**
 * @extends ServiceEntityRepository<WebrootRole>
 */
class WebrootRoleRepository extends ServiceEntityRepository
{
    public function __construct(ManagerRegistry $registry)
    {
        parent::__construct($registry, WebrootRole::class);
    }

    public function findByRolename(string $rolename): ?WebrootRole 
    {
        return $this->createQueryBuilder("wr")
                ->andWhere("wr.role = :val")
                ->setParameter("val", $rolename)
                ->getQuery()
                ->getOneOrNullResult();
    }
    //    /**
    //     * @return WebrootRole[] Returns an array of WebrootRole objects
    //     */
    //    public function findByExampleField($value): array
    //    {
    //        return $this->createQueryBuilder('w')
    //            ->andWhere('w.exampleField = :val')
    //            ->setParameter('val', $value)
    //            ->orderBy('w.id', 'ASC')
    //            ->setMaxResults(10)
    //            ->getQuery()
    //            ->getResult()
    //        ;
    //    }

    //    public function findOneBySomeField($value): ?WebrootRole
    //    {
    //        return $this->createQueryBuilder('w')
    //            ->andWhere('w.exampleField = :val')
    //            ->setParameter('val', $value)
    //            ->getQuery()
    //            ->getOneOrNullResult()
    //        ;
    //    }
}
