src/Controller/Api/GalleryController.php
public function getGalleryMediasAction($id)
    {
        $ghms = $this->getGallery($id)->getGalleryHasMedias();

        $media = [];
        foreach ($ghms as $ghm) {
            $media[] = $ghm->getMedia();
        }

        return $media;
    }
public function getGalleryMediasAction($id)
    {
        $ghms = $this->getGallery($id)->getGalleryHasMedias();

        $media = [];
        foreach ($ghms as $ghm) {
            $media[] = $ghm->getMedia();
        }

        return $media;
    }
public function getGalleryMediasAction ( $ id ) { $ ghms = $ this -> getGallery ( $ id ) -> getGalleryHasMedias ( ) ; $ media = [ ] ; foreach ( $ ghms as $ ghm ) { $ media [ ] = $ ghm -> getMedia ( ) ; } return $ media ; }
Retrieves the medias of specified gallery.

@ApiDoc(
requirements={
{"name"="id", "dataType"="integer", "requirement"="\d+", "description"="gallery id"}
},
output={"class"="Sonata\MediaBundle\Model\Media", "groups"={"sonata_api_read"}},
statusCodes={
200="Returned when successful",
404="Returned when gallery is not found"
}
)

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

@param $id

@return MediaInterface[]
Retrieves the medias of specified gallery .