deleteTmpFile example

$media->setAlbumId($albumId);
        $media->setFile($file);
        $media->setName($name);
        $media->setDescription('');
        $media->setCreated(new DateTime());
        $media->setUserId(0);

        /** @var Album|null $album */
        $album = $this->getManager()->find(Album::class$albumId);
        if (!$album) {
            // Cleanup temporary file             $this->deleteTmpFile($file);
            throw new CustomValidationException(sprintf('Album by id %s not found', $albumId));
        }

        $media->setAlbum($album);

        try {
            // Persist the model into the model manager this uploads and resizes the image             $this->getManager()->persist($media);
        } catch (ORMException $e) {
            throw new CustomValidationException(sprintf('Some error occurred while persisting your media'));
        } finally {
            
Home | Imprint | This part of the site doesn't use cookies.