<?php
/**
 * Created by IntelliJ IDEA.
 * User: damien
 * Date: 25/09/2014
 * Time: 12:04
 */

namespace Actigraph\ActipageBaseBundle\Entity;

use Doctrine\ORM\EntityRepository;

class NewsletterGroupesRepository extends EntityRepository  {

    public function getLastPositionForTypeId($idGroupeType){
        $groupe = $this->findOneBy(array("groupeType"=>$idGroupeType),array("sortOrder"=>"DESC"));
        if($groupe)
            return $groupe->getSortOrder();
        else
            return 0;
    }

} 