<?php

namespace ArcaSolutions\BannersBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * BannerlevelRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class BannerlevelRepository extends EntityRepository
{
    /**
     * Description
     *
     * @param string $level
     * @return mixed
     * @throws \Doctrine\ORM\NonUniqueResultException
     */
    public function getLevelActive($level)
    {
        return $this->createQueryBuilder('bl')
            ->where('bl.active = :active')
            ->andWhere('bl.value = :level')
            ->setParameter('active', 'y')
            ->setParameter('level', $level)
            ->getQuery()
            ->getOneOrNullResult();
    }
}
