Commit ea23088d authored by Jean-Baptiste Oellers's avatar Jean-Baptiste Oellers
Browse files

Présuppression des referents

parent 8571fb5d
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ use Oscar\Entity\Person;
use Oscar\Entity\ProjectMember;
use Oscar\Entity\RecallDeclaration;
use Oscar\Entity\RecallException;
use Oscar\Entity\Referent;
use Oscar\Entity\TimeSheet;
use Oscar\Exception\OscarDeletePersonNotPossibleException;
use Oscar\Exception\OscarException;
@@ -59,6 +60,16 @@ class PersonDeleteService implements UseOscarUserContextService, UseEntityManage
            ->setParameter('person', $person);
        $del->getQuery()->execute();

        $del = $this->getEntityManager()->createQueryBuilder()->delete(Referent::class, 'n')
            ->where('n.referent = :person')
            ->setParameter('person', $person);
        $del->getQuery()->execute();

        $del = $this->getEntityManager()->createQueryBuilder()->delete(Referent::class, 'n')
            ->where('n.person = :person')
            ->setParameter('person', $person);
        $del->getQuery()->execute();

        $this->getEntityManager()->remove($person);
        $this->getEntityManager()->flush();
    }