From a8bf05f65ca6b38bfa560e275d3ea35151668ba0 Mon Sep 17 00:00:00 2001
From: Jeremy Guiselin <jeremy.guiselin@student.ecp.fr>
Date: Thu, 9 Feb 2017 19:25:42 -0500
Subject: [PATCH] Add delete elements method to other than league

---
 .../Repository/NotificationRepository.php             | 11 +++++++++++
 src/BackendBundle/Repository/PredictionRepository.php | 11 +++++++++++
 src/BackendBundle/Repository/TeamRepository.php       | 11 +++++++++++
 3 files changed, 33 insertions(+)

diff --git a/src/BackendBundle/Repository/NotificationRepository.php b/src/BackendBundle/Repository/NotificationRepository.php
index 379f08b..10772a8 100644
--- a/src/BackendBundle/Repository/NotificationRepository.php
+++ b/src/BackendBundle/Repository/NotificationRepository.php
@@ -33,4 +33,15 @@ class NotificationRepository extends EntityRepository
         return  $this->createQueryBuilder('n')
             ->select('n');
     }
+
+    public function deleteElements(array $ids)
+    {
+        $qb = $this->createQueryBuilder('l');
+        $qb
+            ->delete()
+            ->where('l.id IN (:ids)')
+            ->setParameter('ids', $ids);
+        $qb->getQuery()->execute();
+    }
+
 }
diff --git a/src/BackendBundle/Repository/PredictionRepository.php b/src/BackendBundle/Repository/PredictionRepository.php
index f2913a5..ab4ccb9 100644
--- a/src/BackendBundle/Repository/PredictionRepository.php
+++ b/src/BackendBundle/Repository/PredictionRepository.php
@@ -53,4 +53,15 @@ class PredictionRepository extends EntityRepository
 
         return $qb->getQuery()->getResult();
     }
+
+    public function deleteElements(array $ids)
+    {
+        $qb = $this->createQueryBuilder('l');
+        $qb
+            ->delete()
+            ->where('l.id IN (:ids)')
+            ->setParameter('ids', $ids);
+        $qb->getQuery()->execute();
+    }
+
 }
diff --git a/src/BackendBundle/Repository/TeamRepository.php b/src/BackendBundle/Repository/TeamRepository.php
index 574c0ff..09deca3 100644
--- a/src/BackendBundle/Repository/TeamRepository.php
+++ b/src/BackendBundle/Repository/TeamRepository.php
@@ -35,4 +35,15 @@ class TeamRepository extends EntityRepository
             'name' => $pack->getName()
         ]) !== null;
     }
+
+    public function deleteElements(array $ids)
+    {
+        $qb = $this->createQueryBuilder('l');
+        $qb
+            ->delete()
+            ->where('l.id IN (:ids)')
+            ->setParameter('ids', $ids);
+        $qb->getQuery()->execute();
+    }
+
 }
\ No newline at end of file
-- 
GitLab