public function saveMedia($media)
    {
        $file = $media->getFile();
        $this->mediaStorageManager->uploadFile($file->getFilename(), $file->getRealPath(), false);

        $this->objectManager->persist($media);
        $this->objectManager->flush();

        $event = new MediaEvent($media);
        $this->dispatcher->dispatch(MediaEvents::MEDIA_ADD, $event);
    }
public function saveMedia($media)
    {
        $file = $media->getFile();
        $this->mediaStorageManager->uploadFile($file->getFilename(), $file->getRealPath(), false);

        $this->objectManager->persist($media);
        $this->objectManager->flush();

        $event = new MediaEvent($media);
        $this->dispatcher->dispatch(MediaEvents::MEDIA_ADD, $event);
    }
public function saveMedia ( $ media ) { $ file = $ media -> getFile ( ) ; $ this -> mediaStorageManager -> uploadFile ( $ file -> getFilename ( ) , $ file -> getRealPath ( ) , false ) ; $ this -> objectManager -> persist ( $ media ) ; $ this -> objectManager -> flush ( ) ; $ event = new MediaEvent ( $ media ) ; $ this -> dispatcher -> dispatch ( MediaEvents :: MEDIA_ADD , $ event ) ; }
Save a media in database

@param MediaInterface $media
Save a media in database