<?php
/**
 * Created by IntelliJ IDEA.
 * User: damien
 * Date: 10/02/2017
 * Time: 22:45
 */

namespace Actigraph\ActipageBaseBundle\Services;


use Actigraph\ActipageBaseBundle\Entity\Banniere;
use Doctrine\ORM\EntityManagerInterface;

class BanniereDiaporamaService
{
    private $doctrine;

    public function __construct(EntityManagerInterface $doctrine)
    {
        $this->doctrine = $doctrine;
    }

    public function getActivesBaniere(){
        $em = $this->doctrine;
        /** @var Banniere $banniere */
        $bannieres = $em->getRepository('ActigraphActipageBaseBundle:Banniere')->findBy(array("affiche"=>1));
        if($bannieres){
            return $bannieres;
        }
        return array();
    }

}