src/PHPDish/Bundle/MediaBundle/Twig/MediaExtension.php
public function buildMediaUrl($key, $alias = null)
    {
        $serviceId = $alias ? 'phpdish.media.url_builder.' .  $alias : 'phpdish.media.url_builder';
        try {
            $urlBuilder = $this->container->get($serviceId);
        } catch (ServiceNotFoundException $exception) {
            throw new \InvalidArgumentException(sprintf('Invalid Media Service Alias "%s"', $alias));
        }
        return $urlBuilder->build($key);
    }
public function buildMediaUrl($key, $alias = null)
    {
        $serviceId = $alias ? 'phpdish.media.url_builder.' .  $alias : 'phpdish.media.url_builder';
        try {
            $urlBuilder = $this->container->get($serviceId);
        } catch (ServiceNotFoundException $exception) {
            throw new \InvalidArgumentException(sprintf('Invalid Media Service Alias "%s"', $alias));
        }
        return $urlBuilder->build($key);
    }
构建媒体资源的访问链接
@param string $key
@param string $alias
@return string