/** * if in form was clicked delete button and file has not file name - then delete this file record from the db * * @param File $entity * @param EntityManager $em */ public function checkOnDelete(File $entity, EntityManager $em) { if ($entity->isEmptyFile() && $entity->getFilename() === null) { $em->remove($entity); } }