Remove file

@param \Enhavo\Bundle\MediaBundle\Entity\File $file
420848
public function removeFile(\Enhavo\Bundle\MediaBundle\Entity\File $file)
    {
        $this->files->removeElement($file);
    }
371149
public static function delFile($file, $image = false)
    {
        $fileStatic = Folder::getStatic($file);

        if(!file_exists($fileStatic)){
            return;
        }

        if(file_exists($fileStatic) && !is_dir($fileStatic)){
            @unlink($fileStatic);
        }

        if($image){
            $pathInfo = pathinfo($file);

            if($pathInfo['dirname'] == UPLOAD_FOLDER){
                $thumbFolder = THUMB_FOLDER;
            }else{
                $thumbFolder = str_replace(UPLOAD_FOLDER . '/', THUMB_FOLDER . '/', $pathInfo['dirname']);
            }

            $thumbs = glob(Folder::getStatic($thumbFolder . '/' . $pathInfo['filename'] . '_*.' . $pathInfo['extension']));

            if($thumbs){
                foreach($thumbs as $thumb){
                    @unlink($thumb);
                }
            }
        }
    }
1240075
public function deleteFile($file)
    {
        if (!$this->filesystem->has($file)) {
            return;
        }

        $this->filesystem->delete($file);
        $this->cacheManager->remove($file);
    }
306702
private function deleteFile($file) {
		try {
			if($this->client && $this->client->enabled()) {
				$this->client->delete($file);
			}
		}
		catch(StorageException $ex) {
			Logger::error("Error deleting file '$file'.", ['exception' => $ex->getMessage(), 'Key' => $file]);
		}
	}
429907
public static function remove(string $file = ''): bool
    {
        $file = static::normalizePath($file);
        if (static::exists($file)) {
            return @\unlink($file);
        }
        return false;
    }
1309464
public static function Delete( string $file )
   {

      if ( ! \file_exists( $file ) )
      {
         // No deleting required
         return;
      }

      try
      {
         \unlink( $file );
         \clearstatcache();
         if ( ! \file_exists( $file ) )
         {
            // Deleting was successfull
            return;
         }
      }
      catch ( \Throwable $ex ) { }

      if ( static::IS_WIN )
      {
         $f = \escapeshellarg( $file );
         try { \exec( "del {$f}" ); }
         catch ( \Throwable $ex )
         {
            throw new IOError( 'IO', $file, 'Deleting the defined file fails!', \E_USER_ERROR, $ex );
         }
         \clearstatcache();
         if ( \file_exists( $file ) )
         {
            throw new IOError( 'IO', $file, 'Deleting the defined file fails! No known method works.' );
         }
         return;
      }

      try { \exec( "unlink {$file}" ); }
      catch ( \Throwable $ex )
      {
         throw new IOError( 'IO', $file, 'Deleting the defined file fails!', \E_USER_ERROR, $ex );
      }

      \clearstatcache();

      if ( \file_exists( $file ) )
      {
         throw new IOError( 'IO', $file, 'Deleting the defined file fails!' );
      }

   }
1220306
public function removeItem(\Interne\SeanceBundle\Entity\Item $item)
    {
        $this->items->removeElement($item);
    }
780231
private static function remove($file = '')
    {
        if (is_dir($file)) {
            self::deleteDirectory($file);
        }
        if (is_file($file)) {
            unlink($file);
        }
    }
389500
public function delete(File $file)
    {
        if ($this->adapter->delete($file->path)) {
            return $file;
        }

        return false;
    }
821867
public function removeLoaderByFile($file)
    {
        foreach ($this->loaders as $i => $loader) {
            /** @var LoaderInterface $loader */
            if ($loader->supports($file)) {
                unset($this->loaders[$i]);
            }
        }
    }
584407
public static void deleteFile(@NonNull File file) {
    boolean deleted = file.delete();
    if (!deleted) {
      Log.w(LOG_TAG, "Could not delete file: " + file);
    }
  }
66809
public function delete($file)
    {
        $file = $this->path($file);

        if (is_dir($file)) {
            return @rmdir($file);
        }

        return @unlink($file);
    }
388404
public function removePicture(\Enhavo\Bundle\MediaBundle\Entity\File $pictures)
    {
        $this->pictures->removeElement($pictures);
    }
917642
public function delete( $file ) {

		$parent = $this->get_file( dirname( $file ) );

		$filename = basename( $file );

		if (
			false === $parent
			|| 'dir' !== $parent->type
			|| false === isset( $parent->contents->$filename )
		) {
			return false;
		}

		unset( $parent->contents->$filename );

		return true;
	}
1190488
public function renameFile(File $file, $fileName)
	{
		$entityManager = $this->getDoctrineEntityManager();

		$originFile = clone($file);
		$entityManager->detach($originFile);

		try {
			
			$file->setFileName($fileName);
			
		} catch (\Exception $e) {
			
			throw new Exception\UploadFilterException(self::VALIDATION_EXTENSION_RENAME_MESSAGE_KEY);
		}

		$this->validateFileUpload($file);

		// rename is wrapped into transaction so if something will fail in rename()
		// entity changes will be rolled back
		$entityManager->beginTransaction();
		
		try { 
			// flush will trigger path generator and path transformers
			$entityManager->flush($file);
			
			$this->renameFileInFileSystem($originFile, $file);
			
		} catch (\Exception $e) {	
			$entityManager->rollback();
			throw $e;
		}
		
		$entityManager->commit();
	}
1281266
public static function remove($file, $silenceErrors = false)
    {
        if (!file_exists($file)) {
            return;
        }

        $result = @unlink($file);

        // Testing if the file still exist avoids race conditions
        if (!$result && file_exists($file)) {
            if ($silenceErrors) {
                Log::warning('Failed to delete file ' . $file);
            } else {
                throw new \RuntimeException('Unable to delete file ' . $file);
            }
        }
    }
799415
public function removeDocument(\Innova\CollecticielBundle\Entity\Document $documents)
    {
        $this->documents->removeElement($documents);
    }