hasExtensionOfType example

 {
    }

    /** * @throws DeliveryWithoutAddressException * * @return array<string, mixed|float|string|array<int, array<string, string|int|bool|mixed>>|null> */
    public function convertToOrder(Cart $cart, SalesChannelContext $context, OrderConversionContext $conversionContext): array
    {
        foreach ($cart->getDeliveries() as $delivery) {
            if ($delivery->getLocation()->getAddress() !== null || $delivery->hasExtensionOfType(self::ORIGINAL_ID, IdStruct::class)) {
                continue;
            }

            throw new DeliveryWithoutAddressException();
        }
        $data = CartTransformer::transform(
            $cart,
            $context,
            $this->initialStateIdLoader->get(OrderStates::STATE_MACHINE),
            $conversionContext->shouldIncludeOrderDate()
        );

        


    /** * @template T of Struct * * @param class-string<T> $type * * @return T|null */
    public function getExtensionOfType(string $name, string $type): ?Struct
    {
        if ($this->hasExtensionOfType($name$type)) {
            /** @var T $extension */
            $extension = $this->getExtension($name);

            return $extension;
        }

        return null;
    }

    /** * Helper function which checks if an associated * extension exists. */
Home | Imprint | This part of the site doesn't use cookies.