public function resolveLinkCollection(array $links, array $parameters = []): array
    {
        $locale = $parameters['locale'] ?? null;

        // We load all resources for the given resource types
        $types = \array_unique(\array_map(function (Link $link) {
            return $link->getLinkType();
        }, $links));

        $resources = [];
        foreach ($types as $type) {
            $resources = \array_merge($resources, $this->resolveLinksForResourceType($type, $links, $locale));
        }

        $collection = [];
        foreach ($links as $link) {
            $key = $link->getLinkType().'.'.$link->getId();

            if (isset($resources[$key])) {
                $collection[] = $resources[$key];
            }
        }

        return $collection;
    }
public function resolveLinkCollection(array $links, array $parameters = []): array
    {
        $locale = $parameters['locale'] ?? null;

        // We load all resources for the given resource types
        $types = \array_unique(\array_map(function (Link $link) {
            return $link->getLinkType();
        }, $links));

        $resources = [];
        foreach ($types as $type) {
            $resources = \array_merge($resources, $this->resolveLinksForResourceType($type, $links, $locale));
        }

        $collection = [];
        foreach ($links as $link) {
            $key = $link->getLinkType().'.'.$link->getId();

            if (isset($resources[$key])) {
                $collection[] = $resources[$key];
            }
        }

        return $collection;
    }
{@inheritdoc}