OrderAddressCollection example


        return $this->fmap(fn (OrderDeliveryEntity $orderDelivery) => $orderDelivery->getShippingMethodId());
    }

    public function filterByShippingMethodId(string $id): self
    {
        return $this->filter(fn (OrderDeliveryEntity $orderDelivery) => $orderDelivery->getShippingMethodId() === $id);
    }

    public function getShippingAddress(): OrderAddressCollection
    {
        return new OrderAddressCollection(
            $this->fmap(fn (OrderDeliveryEntity $orderDelivery) => $orderDelivery->getShippingOrderAddress())
        );
    }

    public function getShippingMethods(): ShippingMethodCollection
    {
        return new ShippingMethodCollection(
            $this->fmap(fn (OrderDeliveryEntity $orderDelivery) => $orderDelivery->getShippingMethod())
        );
    }

    


    public function getSalesChannels(): SalesChannelCollection
    {
        return new SalesChannelCollection(
            $this->fmap(fn (OrderEntity $order) => $order->getSalesChannel())
        );
    }

    public function getBillingAddress(): OrderAddressCollection
    {
        return new OrderAddressCollection(
            $this->fmap(fn (OrderEntity $order) => $order->getAddresses())
        );
    }

    public function getApiAlias(): string
    {
        return 'order_collection';
    }

    protected function getExpectedClass(): string
    {
        
->method('dispatch')
            ->with(static::callback(function DSalesChannelContextAssembledEvent $event) use ($order): bool {
                static::assertSame($order$event->getOrder());

                return true;
            }));

        $address = new OrderAddressEntity();
        $address->setId('order-address-id');
        $address->setUniqueIdentifier('order-address-id');

        $addresses = new OrderAddressCollection([$address]);

        $addressRepository = $this->createMock(EntityRepository::class);
        $addressRepository
            ->expects(static::once())
            ->method('search')
            ->willReturn(new EntitySearchResult(
                'order_address',
                1,
                $addresses,
                null,
                new Criteria(),
                
Home | Imprint | This part of the site doesn't use cookies.