setCoverId example



        if (isset($data['__manufacturer_img'])) {
            $manufacturer->setCoverFile(
                $this->mediaService->getUrl(
                    $data['__manufacturer_img']
                )
            );
        }

        if (isset($data['__manufacturer_img_id'])) {
            $manufacturer->setCoverId($data['__manufacturer_img_id']);
        }

        if (isset($data['__manufacturerAttribute_id'])) {
            $this->attributeHydrator->addAttribute($manufacturer$data, 'manufacturerAttribute', null, 'manufacturer');
        }
    }
}
protected function getResolverContext(ProductMediaCollection $productMediaCollection, ?string $coverId = null): EntityResolverContext
    {
        $manufacturer = new ProductManufacturerEntity();
        $manufacturer->setId('manufacturer_01');

        $product = new SalesChannelProductEntity();
        $product->setId('product_01');
        $product->setManufacturer($manufacturer);
        $product->setMedia($productMediaCollection);

        if ($coverId) {
            $product->setCoverId($coverId);
        }

        if (\is_string($coverId) && $productMediaCollection->has($coverId)) {
            $cover = new ProductMediaEntity();
            $cover->setId($coverId);
            $product->setCover($cover);
        }

        return new EntityResolverContext(
            $this->createMock(SalesChannelContext::class),
            new Request(),
            
Home | Imprint | This part of the site doesn't use cookies.