getBool example

$this->eventDispatcher->dispatch($event);

        return new NoContentResponse();
    }

    /** * @deprecated tag:v6.6.0 - reason:visibility-change - will be private in v6.6.0 */
    public function isNewsletterDoi(SalesChannelContext $context): ?bool
    {
        if ($context->getCustomerId() === null) {
            return $this->systemConfigService->getBool('core.newsletter.doubleOptIn', $context->getSalesChannelId());
        }

        return $this->systemConfigService->getBool('core.newsletter.doubleOptInRegistered', $context->getSalesChannelId());
    }

    private function getOptInValidator(DataBag $dataBag, SalesChannelContext $context, bool $validateStorefrontUrl): DataValidationDefinition
    {
        $definition = new DataValidationDefinition('newsletter_recipient.create');
        $definition->add('email', new NotBlank()new Email())
            ->add('option', new NotBlank()new Choice(array_keys($this->getOptionSelection($context))));

        

        return $this->needsApprovalRequest;
    }

    public function isApprovalAlreadyRequested(): bool
    {
        return $this->systemConfigService->get(ApprovalDetector::SYSTEM_CONFIG_KEY_SHARE_DATA) !== null;
    }

    public function isApprovalGiven(): bool
    {
        return $this->systemConfigService->getBool(ApprovalDetector::SYSTEM_CONFIG_KEY_SHARE_DATA);
    }
}


        $productIds = array_filter($productIdsstatic fn ($productId) => Uuid::isValid($productId));

        $criteria->setLimit(self::LIMIT);
        $criteria->setIds($productIds);

        $criteria->addAssociation('manufacturer')
            ->addAssociation('options.group')
            ->setTotalCountMode(Criteria::TOTAL_COUNT_MODE_EXACT);

        if ($this->systemConfigService->getBool(
            'core.listing.hideCloseoutProductsWhenOutOfStock',
            $context->getSalesChannelId()
        )) {
            $closeoutFilter = $this->productCloseoutFilterFactory->create($context);
            $criteria->addFilter($closeoutFilter);
        }

        return $criteria;
    }
}
$products = $this->productRepository->search($criteria$context);

        $event = new CustomerWishlistProductListingResultEvent($request$products$context);
        $this->eventDispatcher->dispatch($event);

        return $products;
    }

    private function handleAvailableStock(Criteria $criteria, SalesChannelContext $context): Criteria
    {
        $hide = $this->systemConfigService->getBool(
            'core.listing.hideCloseoutProductsWhenOutOfStock',
            $context->getSalesChannelId()
        );

        if (!$hide) {
            return $criteria;
        }

        $closeoutFilter = $this->productCloseoutFilterFactory->create($context);
        $criteria->addFilter($closeoutFilter);

        

    }

    /** * @param array<mixed>|bool|int|float|string|null $writtenValue * * @dataProvider getBoolProvider */
    public function testGetBool($writtenValue, bool $expected): void
    {
        $this->systemConfigService->set('foo.bar', $writtenValue);
        $actual = $this->systemConfigService->getBool('foo.bar');
        static::assertSame($expected$actual);
    }

    /** * mysql 5.7.30 casts 0.0 to 0 */
    public function testFloatZero(): void
    {
        $this->systemConfigService->set('foo.bar', 0.0);
        $actual = $this->systemConfigService->get('foo.bar');
        static::assertEquals(0.0, $actual);
    }
Home | Imprint | This part of the site doesn't use cookies.