Skip to content
Snippets Groups Projects
Commit 780f3cb5 authored by YvanSv's avatar YvanSv
Browse files

suppression des notifications

parent f053c5bb
No related branches found
No related tags found
1 merge request!67suppression des notifications
......@@ -26,4 +26,17 @@ class NotificationsController extends AbstractController
'notifs' => $notifs
]);
}
#[Route('/notificationsSupprimer/{id}', name: 'app_notifications_supprimer')]
public function supprimer($id): Response
{
$entityManager = $this->doctrine->getManager();
$notif = $entityManager->getRepository(Notification::class)->find($id);
if ($notif)
$entityManager->remove($notif);
$entityManager->flush();
$notifs = $entityManager->getRepository(Notification::class)->findBy(['user_id' => $this->getUser()]);
return $this->redirectToRoute('app_notifications');
}
}
......@@ -21,6 +21,7 @@
<td>{{ notif.date|date('d/m/y') }}</td>
<td>{{ notif.type }}</td>
<td>{{ notif.description }}</td>
<td><a href="{{ path('app_notifications_supprimer', {'id': notif.id}) }}"><button>Supprimer</button></a>
</tr>
{% endfor %}
{% else %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment