implement deletion of offer

This commit is contained in:
Jannis Portmann 2021-05-15 12:18:23 +02:00
parent 54dd7caf3f
commit 07cb90e7fb
2 changed files with 19 additions and 1 deletions

View file

@ -120,4 +120,22 @@ class OfferController extends AbstractController
throw new HttpException(403, "No permission");
}
#[Route('/offer/delete/{id}', name: 'delete_offer')]
public function deleteOffer(Offering $offer): Response
{
$user = $this->getUser();
if ($offer->getByUser() === $user)
{
$this->entityManager->remove($offer);
$this->entityManager->flush();
}
$this->addFlash(
'success','Successfully removed offer!'
);
return $this->redirectToRoute('user_page');
}
}