Check if photoFilname is set before deleting

This commit is contained in:
Jannis Portmann 2021-09-14 23:43:29 +02:00
parent d1ba54c9f9
commit 28f71ee479

View file

@ -131,8 +131,11 @@ class OfferController extends AbstractController
$user = $this->getUser();
if ($offer->getByUser() === $user)
{
if($offer->getPhotoFilename() != null)
{
$offerPhotoHelper->deleteOfferPhoto($photoDir, $offer->getPhotoFilename());
}
$this->entityManager->remove($offer);
$this->entityManager->flush();
$this->addFlash(