/**
  * @param Folder $folder
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function deleteAction(Folder $folder)
 {
     $this->denyAccessUnlessGranted('ROLE_ADMIN', null, 'Unable to access this page!');
     $folderManager = $this->getFolderManager();
     $fileManager = $this->getFileManager();
     if (!$folder) {
         throw $this->createNotFoundException('Unable to find Folder entity.');
     }
     foreach ($folder->getFiles() as $file) {
         //            $file->removeUpload();
         $fileManager->remove($file);
     }
     $folderManager->remove($folder, true);
     return $this->redirect($this->generateUrl('sfs_homepage'));
 }
 /**
  * @param File   $entity
  * @param Folder $folder
  * @return \Symfony\Component\Form\Form
  */
 private function createCreateForm(File $entity, Folder $folder)
 {
     $form = $this->createForm(new FileType(), $entity, ['action' => $this->generateUrl('ratp_file_create', ['id' => $folder->getId()]), 'method' => 'POST']);
     $form->add('submit', 'submit', ['label' => 'Ajouter']);
     return $form;
 }