Commit ea37da6e by Administrator

Modification de FluxRepository.php pour prendre en compte le préfixe de la table 'flux'

parent e838d298
......@@ -21,6 +21,9 @@ class FluxRepository extends ServiceEntityRepository
public function __construct(RegistryInterface $registry)
{
parent::__construct($registry, Flux::class);
$em = $this->getEntityManager();
$this->connection = $em->getConnection();
$this->tableName = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName();
}
/**
......@@ -29,9 +32,7 @@ class FluxRepository extends ServiceEntityRepository
*/
public function getQueryByPrestataire(Prestataire $presta)
{
$em = $this->getEntityManager();
$connection = $em->getConnection();
$statement = $connection->prepare("SELECT f.id FROM flux f WHERE f.prestataire_id = :id OR f.prestataire_dest_id = :id");
$statement = $this->connection->prepare("SELECT f.id FROM {$this->tableName} f WHERE f.prestataire_id = :id OR f.prestataire_dest_id = :id");
$statement->bindValue('id', $presta->getId());
$statement->execute();
$results = $statement->fetchAll();
......@@ -50,9 +51,7 @@ class FluxRepository extends ServiceEntityRepository
*/
public function getQueryByAdherent(Adherent $adherent)
{
$em = $this->getEntityManager();
$connection = $em->getConnection();
$statement = $connection->prepare("SELECT f.id FROM flux f WHERE f.adherent_id = :id OR f.adherent_dest_id = :id");
$statement = $this->connection->prepare("SELECT f.id FROM {$this->tableName} f WHERE f.adherent_id = :id OR f.adherent_dest_id = :id");
$statement->bindValue('id', $adherent->getId());
$statement->execute();
$results = $statement->fetchAll();
......@@ -71,9 +70,8 @@ class FluxRepository extends ServiceEntityRepository
*/
public function getQueryByComptoir(Comptoir $comptoir)
{
$em = $this->getEntityManager();
$connection = $em->getConnection();
$statement = $connection->prepare("SELECT f.id FROM flux f WHERE f.comptoir_id = :id");
$statement = $this->connection->prepare("SELECT f.id FROM {$this->tableName} f WHERE f.comptoir_id = :id");
$statement->bindValue('id', $comptoir->getId());
$statement->execute();
$results = $statement->fetchAll();
......@@ -92,9 +90,7 @@ class FluxRepository extends ServiceEntityRepository
*/
public function getQueryByGroupe(Groupe $groupe)
{
$em = $this->getEntityManager();
$connection = $em->getConnection();
$statement = $connection->prepare("SELECT f.id FROM flux f WHERE f.groupe_id = :id");
$statement = $this->connection->prepare("SELECT f.id FROM {$this->tableName} f WHERE f.groupe_id = :id");
$statement->bindValue('id', $groupe->getId());
$statement->execute();
$results = $statement->fetchAll();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment