@@ 271-284 (lines=14) @@ | ||
268 | $em = $this->getDoctrine()->getManager(); |
|
269 | /* @var UserInterface $user */ |
|
270 | $user = $em->getRepository($this->container->getParameter('fos_user.model.user.class'))->find($id); |
|
271 | if (!\is_null($user)) { |
|
272 | $userEvent = new UserEvent($user, $request); |
|
273 | $this->container->get('event_dispatcher')->dispatch(UserEvents::USER_DELETE_INITIALIZE, $userEvent); |
|
274 | ||
275 | $em->remove($user); |
|
276 | $em->flush(); |
|
277 | ||
278 | $this->addFlash( |
|
279 | FlashTypes::SUCCESS, |
|
280 | $this->container->get('translator')->trans('kuma_user.users.delete.flash.success.%username%', [ |
|
281 | '%username%' => $user->getUsername(), |
|
282 | ]) |
|
283 | ); |
|
284 | } |
|
285 | ||
286 | return new RedirectResponse($this->generateUrl('KunstmaanUserManagementBundle_settings_users')); |
|
287 | } |
|
@@ 237-250 (lines=14) @@ | ||
234 | $em = $this->getDoctrine()->getManager(); |
|
235 | /* @var UserInterface $user */ |
|
236 | $user = $em->getRepository($this->container->getParameter('fos_user.model.user.class'))->find($id); |
|
237 | if (!\is_null($user)) { |
|
238 | $userEvent = new UserEvent($user, $request); |
|
239 | $this->container->get('event_dispatcher')->dispatch(UserEvents::USER_DELETE_INITIALIZE, $userEvent); |
|
240 | ||
241 | $em->remove($user); |
|
242 | $em->flush(); |
|
243 | ||
244 | $this->addFlash( |
|
245 | FlashTypes::SUCCESS, |
|
246 | $this->container->get('translator')->trans('kuma_user.users.delete.flash.success.%username%', [ |
|
247 | '%username%' => $user->getUsername(), |
|
248 | ]) |
|
249 | ); |
|
250 | } |
|
251 | ||
252 | return new RedirectResponse($this->generateUrl('KunstmaanUserManagementBundle_settings_users')); |
|
253 | } |