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

Ajout présuppression des liens avec les projets

parent f17e2506
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ namespace Oscar\Service;
use Oscar\Entity\ActivityPerson;
use Oscar\Entity\OrganizationPerson;
use Oscar\Entity\Person;
use Oscar\Entity\ProjectMember;
use Oscar\Entity\TimeSheet;
use Oscar\Exception\OscarDeletePersonNotPossibleException;
use Oscar\Exception\OscarException;
@@ -41,6 +42,11 @@ class PersonDeleteService implements UseOscarUserContextService, UseEntityManage
            ->setParameter('person', $person);
        $del->getQuery()->execute();

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

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