Check if filename is set before deleting
This commit is contained in:
parent
2e4e005a55
commit
5680522395
1 changed files with 4 additions and 1 deletions
|
@ -144,8 +144,11 @@ class OfferController extends AbstractController
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
if ($offer->getByUser() === $user)
|
if ($offer->getByUser() === $user)
|
||||||
|
{
|
||||||
|
if ($offer->getPhotoFilename())
|
||||||
{
|
{
|
||||||
unlink($photoDir . '/' . $offer->getPhotoFilename());
|
unlink($photoDir . '/' . $offer->getPhotoFilename());
|
||||||
|
}
|
||||||
$this->entityManager->remove($offer);
|
$this->entityManager->remove($offer);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
$this->addFlash(
|
$this->addFlash(
|
||||||
|
|
Reference in a new issue