getMediaIds example

$taxes = $this->getTaxes($context);

        if ($taxes->count() === 0) {
            throw new \RuntimeException('This demo data command should be executed after the original demo data was executed at least one time');
        }

        $properties = $this->getProperties();

        $this->io->progressStart($count);

        $mediaIds = $this->getMediaIds();
        $downloadMediaIds = $this->getMediaIds('product_download');

        $ruleIds = $this->getIds('rule');

        $manufacturers = $this->getIds('product_manufacturer');

        $tags = $this->getIds('tag');

        $instantDeliveryId = $this->getInstantDeliveryId();

        $combinations = [];
        
'doc_type' => 'foo', 'doc_id' => $idC],
                ['doc_type' => 'bar', 'doc_id' => $idD],
            ]);

        $document = new RenderedDocument();
        $document->setContent('');
        $this->documentGenerator
            ->expects(static::exactly(4))
            ->method('readDocument')
            ->willReturn($document);

        $criteria = new Criteria($extension->getMediaIds());
        $criteria->setTitle('send-mail::load-media');
        $entities = array_map(static function Dstring $id): MediaEntity {
            $media = new MediaEntity();
            $media->setId($id);

            return $media;
        }$extension->getMediaIds());

        $this->mediaRepository
            ->expects(static::once())
            ->method('search')
            
return $result;
    }

    /** * @param array<int, Blog> $blogs */
    private function resolveMedias(array $blogs, ShopContextInterface $context): void
    {
        $mediaIds = [];
        foreach ($blogs as $blog) {
            if (\count($blog->getMediaIds()) === 0) {
                continue;
            }

            $mediaIds[] = $blog->getMediaIds();
        }

        if (\count($mediaIds) === 0) {
            return;
        }

        $mediaIds = array_keys(array_flip(array_merge(...$mediaIds)));
        
public function __invoke(GenerateThumbnailsMessage|UpdateThumbnailsMessage $msg): void
    {
        if (Feature::isActive('v6.6.0.0')) {
            $context = $msg->getContext();
        } else {
            $context = $msg->readContext();
        }

        $criteria = new Criteria();
        $criteria->addAssociation('mediaFolder.configuration.mediaThumbnailSizes');
        $criteria->addFilter(new EqualsAnyFilter('media.id', $msg->getMediaIds()));

        /** @var MediaCollection $entities */
        $entities = $this->mediaRepository->search($criteria$context)->getEntities();

        if ($msg instanceof UpdateThumbnailsMessage) {
            foreach ($entities as $media) {
                $this->thumbnailService->updateThumbnails($media$context$msg->isStrict());
            }
        } else {
            $this->thumbnailService->generate($entities$context);
        }
    }
if (!empty($eventConfig['documentTypeIds']) && \is_array($eventConfig['documentTypeIds']) && $orderId) {
            $latestDocuments = $this->getLatestDocumentsOfTypes($orderId$eventConfig['documentTypeIds']);

            $documentIds = array_unique(array_merge($documentIds$latestDocuments));
        }

        if (!empty($documentIds)) {
            $extensions->setDocumentIds($documentIds);
            $attachments = $this->mappingAttachments($documentIds$attachments$context);
        }

        if (empty($extensions->getMediaIds())) {
            return $attachments;
        }

        $criteria = new Criteria($extensions->getMediaIds());
        $criteria->setTitle('send-mail::load-media');

        /** @var MediaCollection<MediaEntity> $entities */
        $entities = $this->mediaRepository->search($criteria$context);

        foreach ($entities as $media) {
            $attachments[] = $this->mediaService->getAttachment($media$context);
        }
Home | Imprint | This part of the site doesn't use cookies.