setIsStrict example

$affectedMediaIds = [...array_combine($this->initialMediaIds, $this->initialMediaIds), ...$newMedia->getIds()];

        $expectedMessageStrict = new UpdateThumbnailsMessage();

        if (Feature::isActive('v6.6.0.0')) {
            $expectedMessageStrict->setContext($this->context);
        } else {
            $expectedMessageStrict->withContext($this->context);
        }

        $expectedMessageStrict->setIsStrict(true);
        $expectedMessageStrict->setMediaIds($affectedMediaIds);

        $expectedMessageNonStrict = new UpdateThumbnailsMessage();

        if (Feature::isActive('v6.6.0.0')) {
            $expectedMessageNonStrict->setContext($this->context);
        } else {
            $expectedMessageNonStrict->withContext($this->context);
        }

        $expectedMessageNonStrict->setIsStrict(false);
        


    /** * @param RepositoryIterator<MediaCollection> $mediaIterator */
    private function generateAsynchronous(RepositoryIterator $mediaIterator, Context $context): void
    {
        $batchCount = 0;
        $this->io->comment('Generating batch jobs...');
        while (($result = $mediaIterator->fetch()) !== null) {
            $msg = new UpdateThumbnailsMessage();
            $msg->setIsStrict($this->isStrict);
            $msg->setMediaIds($result->getEntities()->getIds());

            if (Feature::isActive('v6.6.0.0')) {
                $msg->setContext($context);
            } else {
                $msg->withContext($context);
            }

            $this->messageBus->dispatch($msg);
            ++$batchCount;
        }
        
$generateMessage = new GenerateThumbnailsMessage();
        $generateMessage->setMediaIds($testEntities1->getIds());

        if (Feature::isActive('v6.6.0.0')) {
            $generateMessage->setContext($this->context);
        } else {
            $generateMessage->withContext($this->context);
        }

        $updateMessage1 = new UpdateThumbnailsMessage();
        $updateMessage1->setMediaIds($testEntities2->getIds());
        $updateMessage1->setIsStrict(true);

        if (Feature::isActive('v6.6.0.0')) {
            $updateMessage1->setContext($this->context);
        } else {
            $updateMessage1->withContext($this->context);
        }

        $updateMessage2 = new UpdateThumbnailsMessage();
        $updateMessage2->setMediaIds($testEntities3->getIds());
        $updateMessage2->setIsStrict(false);

        
Home | Imprint | This part of the site doesn't use cookies.