private function findMedia($path)
    {
        /** @var \Ekyna\Bundle\MediaBundle\Model\MediaInterface $media */
        $media = $this
            ->get('ekyna_media.media.repository')
            ->findOneBy(['path' => $path])
        ;
        if (null === $media) {
            throw new NotFoundHttpException('Media not found');
        }

        $fs = $this->get('local_media_filesystem');
        if (!$fs->has($media->getPath())) {
            throw new NotFoundHttpException('Media not found');
        }
        $file = $fs->get($media->getPath());

        return [$media, $file];
    }
private function findMedia($path)
    {
        /** @var \Ekyna\Bundle\MediaBundle\Model\MediaInterface $media */
        $media = $this
            ->get('ekyna_media.media.repository')
            ->findOneBy(['path' => $path])
        ;
        if (null === $media) {
            throw new NotFoundHttpException('Media not found');
        }

        $fs = $this->get('local_media_filesystem');
        if (!$fs->has($media->getPath())) {
            throw new NotFoundHttpException('Media not found');
        }
        $file = $fs->get($media->getPath());

        return [$media, $file];
    }
private function findMedia ( $ path ) { /** @var \Ekyna\Bundle\MediaBundle\Model\MediaInterface $media */ $ media = $ this -> get ( 'ekyna_media.media.repository' ) -> findOneBy ( [ 'path' => $ path ] ) ; if ( null === $ media ) { throw new NotFoundHttpException ( 'Media not found' ) ; } $ fs = $ this -> get ( 'local_media_filesystem' ) ; if ( ! $ fs -> has ( $ media -> getPath ( ) ) ) { throw new NotFoundHttpException ( 'Media not found' ) ; } $ file = $ fs -> get ( $ media -> getPath ( ) ) ; return [ $ media , $ file ] ; }
Finds the media by his path.

@param string $path
@return array
@throws NotFoundHttpException
Finds the media by his path .