<?php

namespace Webkul\DamBundle\Services;

use Webkul\DamBundle\Repository\AssetRepository;
use Webkul\DamBundle\Listener\ClassDefinationForCompatibility;

$versionCompatiblility = new ClassDefinationForCompatibility();
$versionCompatiblility->createClassAliases();

/**
 * With the help of this class you can manipulate with the DAM Medias
 */
class DamMediaService
{
    /** @var AssetRepository $assetRepo */
    private $assetRepo;

    public function __construct($assetRepo)
    {
        $this->assetRepo = $assetRepo;
    }

    public function getAllAssetMediasFilePaths()
    {
        $filePaths = [];

        $medias = $this->assetRepo->getAllDamMediasFilePath();
        foreach ($medias as $media) {
            if (isset($media['filePath'])) {
                $filePaths[] = $media['filePath'];
            }
        }

        return $filePaths;
    }
}
