StorefrontMediaUploader example

$file = $this->getUploadFixture('image.png');
        $this->getUploadService()->upload($file, 'test', 'notExistingType', Context::createDefaultContext());
    }

    private function getUploadFixture(string $filename): UploadedFile
    {
        return new UploadedFile(self::FIXTURE_DIR . '/' . $filename$filename, null, null, true);
    }

    private function getUploadService(): StorefrontMediaUploader
    {
        return new StorefrontMediaUploader(
            $this->getContainer()->get(MediaService::class),
            $this->getContainer()->get(FileSaver::class),
            $this->getContainer()->get(StorefrontMediaValidatorRegistry::class)
        );
    }

    private function removeMedia(string $ids): void
    {
        $ids = [$ids];

        $this->getContainer()->get('media.repository')->delete(
            
Home | Imprint | This part of the site doesn't use cookies.