Check if photoFilname is set before deleting
This commit is contained in:
		
							parent
							
								
									d1ba54c9f9
								
							
						
					
					
						commit
						28f71ee479
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		|  | @ -131,8 +131,11 @@ class OfferController extends AbstractController | ||||||
|         $user = $this->getUser();  |         $user = $this->getUser();  | ||||||
| 
 | 
 | ||||||
|         if ($offer->getByUser() === $user) |         if ($offer->getByUser() === $user) | ||||||
|  |         { | ||||||
|  |             if($offer->getPhotoFilename() != null) | ||||||
|             { |             { | ||||||
|                 $offerPhotoHelper->deleteOfferPhoto($photoDir, $offer->getPhotoFilename()); |                 $offerPhotoHelper->deleteOfferPhoto($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