Commit 24d5346d by François C.

Merge branch 'dev' into 'master'

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

See merge request Kohinos/kohinos!1
parents cabc9cbf ea37da6e
...@@ -21,6 +21,9 @@ class FluxRepository extends ServiceEntityRepository ...@@ -21,6 +21,9 @@ class FluxRepository extends ServiceEntityRepository
public function __construct(RegistryInterface $registry) public function __construct(RegistryInterface $registry)
{ {
parent::__construct($registry, Flux::class); 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 ...@@ -29,9 +32,7 @@ class FluxRepository extends ServiceEntityRepository
*/ */
public function getQueryByPrestataire(Prestataire $presta) public function getQueryByPrestataire(Prestataire $presta)
{ {
$em = $this->getEntityManager(); $statement = $this->connection->prepare("SELECT f.id FROM {$this->tableName} f WHERE f.prestataire_id = :id OR f.prestataire_dest_id = :id");
$connection = $em->getConnection();
$statement = $connection->prepare("SELECT f.id FROM flux f WHERE f.prestataire_id = :id OR f.prestataire_dest_id = :id");
$statement->bindValue('id', $presta->getId()); $statement->bindValue('id', $presta->getId());
$statement->execute(); $statement->execute();
$results = $statement->fetchAll(); $results = $statement->fetchAll();
...@@ -50,9 +51,7 @@ class FluxRepository extends ServiceEntityRepository ...@@ -50,9 +51,7 @@ class FluxRepository extends ServiceEntityRepository
*/ */
public function getQueryByAdherent(Adherent $adherent) public function getQueryByAdherent(Adherent $adherent)
{ {
$em = $this->getEntityManager(); $statement = $this->connection->prepare("SELECT f.id FROM {$this->tableName} f WHERE f.adherent_id = :id OR f.adherent_dest_id = :id");
$connection = $em->getConnection();
$statement = $connection->prepare("SELECT f.id FROM flux f WHERE f.adherent_id = :id OR f.adherent_dest_id = :id");
$statement->bindValue('id', $adherent->getId()); $statement->bindValue('id', $adherent->getId());
$statement->execute(); $statement->execute();
$results = $statement->fetchAll(); $results = $statement->fetchAll();
...@@ -71,9 +70,8 @@ class FluxRepository extends ServiceEntityRepository ...@@ -71,9 +70,8 @@ class FluxRepository extends ServiceEntityRepository
*/ */
public function getQueryByComptoir(Comptoir $comptoir) public function getQueryByComptoir(Comptoir $comptoir)
{ {
$em = $this->getEntityManager();
$connection = $em->getConnection(); $statement = $this->connection->prepare("SELECT f.id FROM {$this->tableName} f WHERE f.comptoir_id = :id");
$statement = $connection->prepare("SELECT f.id FROM flux f WHERE f.comptoir_id = :id");
$statement->bindValue('id', $comptoir->getId()); $statement->bindValue('id', $comptoir->getId());
$statement->execute(); $statement->execute();
$results = $statement->fetchAll(); $results = $statement->fetchAll();
...@@ -92,9 +90,7 @@ class FluxRepository extends ServiceEntityRepository ...@@ -92,9 +90,7 @@ class FluxRepository extends ServiceEntityRepository
*/ */
public function getQueryByGroupe(Groupe $groupe) public function getQueryByGroupe(Groupe $groupe)
{ {
$em = $this->getEntityManager(); $statement = $this->connection->prepare("SELECT f.id FROM {$this->tableName} f WHERE f.groupe_id = :id");
$connection = $em->getConnection();
$statement = $connection->prepare("SELECT f.id FROM flux f WHERE f.groupe_id = :id");
$statement->bindValue('id', $groupe->getId()); $statement->bindValue('id', $groupe->getId());
$statement->execute(); $statement->execute();
$results = $statement->fetchAll(); $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