original_string: 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);
      }
code: 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);
      }
code_tokens: 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 ) ; }
docstring: Save a media in database
  
  @param MediaInterface $media
docstring_tokens: Save a media in database