src/Controller/Api/MediaController.php
public function putMediumBinaryContentAction($id, Request $request)
    {
        $media = $this->getMedium($id);

        $media->setBinaryContent($request);

        $this->mediaManager->save($media);

        return $media;
    }
public function putMediumBinaryContentAction($id, Request $request)
    {
        $media = $this->getMedium($id);

        $media->setBinaryContent($request);

        $this->mediaManager->save($media);

        return $media;
    }
public function putMediumBinaryContentAction ( $ id , Request $ request ) { $ media = $ this -> getMedium ( $ id ) ; $ media -> setBinaryContent ( $ request ) ; $ this -> mediaManager -> save ( $ media ) ; return $ media ; }
Set Binary content for a specific media.

@ApiDoc(
input={"class"="Sonata\MediaBundle\Model\Media", "groups"={"sonata_api_write"}},
output={"class"="Sonata\MediaBundle\Model\Media", "groups"={"sonata_api_read"}},
statusCodes={
200="Returned when successful",
404="Returned when media is not found"
}
)

@View(serializerGroups={"sonata_api_read"}, serializerEnableMaxDepthChecks=true)

@param $id
@param Request $request A Symfony request

@throws NotFoundHttpException

@return MediaInterface
Set Binary content for a specific media .