diff --git a/src/AppBundle/Manager/GroupManager.php b/src/AppBundle/Manager/GroupManager.php index 65b84d4..86a981f 100644 --- a/src/AppBundle/Manager/GroupManager.php +++ b/src/AppBundle/Manager/GroupManager.php @@ -151,10 +151,16 @@ public function deleteGroup(UserGroup $group) throw new \InvalidArgumentException('Parent groups cannot be disabled'); } - $group->setActive(0); + $this->dispatcher->dispatch('app.event.group.delete', new GroupEvent($group)); - $this->doctrine->getManager()->flush(); + $em = $this->doctrine->getManager(); - $this->dispatcher->dispatch('app.event.group.delete', new GroupEvent($group)); + if ($group->getType() !== UserGroup::TYPE_LDAP) { + $group->setActive(0); + } else { + $em->remove($group); + } + + $em->flush(); } }