Пример #1
0
 public function fileDelete($id)
 {
     $file = $this->em->getRepository('Uppu3\\Entity\\File')->findOneById($id);
     $filePath = \Uppu3\Helper\FormatHelper::formatUploadLink($file->getId(), $file->getName());
     if (in_array($file->getExtension(), $this->pictures)) {
         $fileResizePath = \Uppu3\Helper\FormatHelper::formatUploadResizeLink($file->getId(), $file->getName());
         unlink($fileResizePath);
     }
     unlink($filePath);
     $this->em->remove($file);
     $this->em->flush();
     echo "all is done";
     die;
 }