public function findMedias(array $types = [])
    {
        if (null === $this->folder) {
            throw new \RuntimeException('No folder selected.');
        }

        $criteria = ['folder' => $this->folder];
        if (count($types)) {
            $criteria['type'] = $types;
        }

        /** @var MediaInterface[] $medias */
        $medias = $this->repository->findBy($criteria);

        foreach ($medias as $media) {
            $media
                ->setThumb($this->thumbGenerator->generateThumbUrl($media))
                ->setFront($this->thumbGenerator->generateFrontUrl($media))
            ;
        }

        return $medias;
    }
public function findMedias(array $types = [])
    {
        if (null === $this->folder) {
            throw new \RuntimeException('No folder selected.');
        }

        $criteria = ['folder' => $this->folder];
        if (count($types)) {
            $criteria['type'] = $types;
        }

        /** @var MediaInterface[] $medias */
        $medias = $this->repository->findBy($criteria);

        foreach ($medias as $media) {
            $media
                ->setThumb($this->thumbGenerator->generateThumbUrl($media))
                ->setFront($this->thumbGenerator->generateFrontUrl($media))
            ;
        }

        return $medias;
    }
public function findMedias ( array $ types = [ ] ) { if ( null === $ this -> folder ) { throw new \ RuntimeException ( 'No folder selected.' ) ; } $ criteria = [ 'folder' => $ this -> folder ] ; if ( count ( $ types ) ) { $ criteria [ 'type' ] = $ types ; } /** @var MediaInterface[] $medias */ $ medias = $ this -> repository -> findBy ( $ criteria ) ; foreach ( $ medias as $ media ) { $ media -> setThumb ( $ this -> thumbGenerator -> generateThumbUrl ( $ media ) ) -> setFront ( $ this -> thumbGenerator -> generateFrontUrl ( $ media ) ) ; } return $ medias ; }
Returns the media found in the current folder.

@param array $types
@return MediaInterface[]
Returns the media found in the current folder .