implement deletion of offer
This commit is contained in:
parent
54dd7caf3f
commit
07cb90e7fb
2 changed files with 19 additions and 1 deletions
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue