<?php


namespace AppBundle\Entity\Repositories;

use Doctrine\ORM\EntityRepository;

class EncaissementsRepository extends EntityRepository
{

    public function findEncaissementsBySiret($siret)
    {
        $sql ="SELECT * FROM `encaissement` AS e 
                WHERE e.interlocuteur_siret ='". $siret."'
                ORDER BY e.date_validation_comptable desc";

        $statement = $this->getEntityManager()->getConnection()->prepare($sql);
        $statement->execute();

        return $statement->fetchAll();
    }

    public function findByDossierAideNumero($numero){
            $sql ="SELECT * FROM `encaissement` AS e
            WHERE e.dossier_aide_numero = '" . $numero . "'";

            $statement = $this->getEntityManager()->getConnection()->prepare($sql);
            $statement->execute();
            
            return $statement->fetchAll();
    }
}
