Skip to content
Snippets Groups Projects
Commit 54865684 authored by mounouar21's avatar mounouar21
Browse files

change delete method for wishlist

parent f454b889
No related branches found
No related tags found
No related merge requests found
...@@ -110,7 +110,7 @@ public function show(Wishlist $wishlist, Request $request): Response ...@@ -110,7 +110,7 @@ public function show(Wishlist $wishlist, Request $request): Response
{ {
// Validate the CSRF token before deleting the wishlist // Validate the CSRF token before deleting the wishlist
if ($this->isCsrfTokenValid('delete'.$wishlist->getId(), $request->getPayload()->getString('_token'))) { if ($this->isCsrfTokenValid('delete'.$wishlist->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($wishlist); // Remove the wishlist from the database $entityManager->delete($wishlist); // Remove the wishlist from the database
$entityManager->flush(); // Save changes to the database $entityManager->flush(); // Save changes to the database
} }
......
...@@ -30,7 +30,7 @@ class WishlistRepository extends ServiceEntityRepository ...@@ -30,7 +30,7 @@ class WishlistRepository extends ServiceEntityRepository
public function removeWishlist(int $wishlistId) { public function removeWishlist(int $wishlistId) {
$wishlist = $this->find($wishlistId); $wishlist = $this->find($wishlistId);
if ($wishlist) { if ($wishlist) {
$this->getEntityManager()->remove($wishlist); $this->getEntityManager()->delete($wishlist);
$this->getEntityManager()->flush(); $this->getEntityManager()->flush();
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment