countryStateNotFound example

$countryStateId = $options[SalesChannelContextService::COUNTRY_STATE_ID];
            \assert(\is_string($countryStateId) && Uuid::isValid($countryStateId));

            $criteria = new Criteria([$countryStateId]);
            $criteria->addAssociation('country');

            $criteria->setTitle('base-context-factory::country');

            $state = $this->countryStateRepository->search($criteria$context)->get($countryStateId);

            if (!$state instanceof CountryStateEntity) {
                throw SalesChannelException::countryStateNotFound($countryStateId);
            }

            /** @var CountryEntity $country */
            $country = $state->getCountry();

            return new ShippingLocation($country$state, null);
        }

        $countryId = $options[SalesChannelContextService::COUNTRY_ID] ?? $salesChannel->getCountryId();
        \assert(\is_string($countryId) && Uuid::isValid($countryId));

        

    public static function exceptionDataProvider(): iterable
    {
        yield CountryException::COUNTRY_NOT_FOUND => [
            'exception' => CountryException::countryNotFound('id-1'),
            'statusCode' => Response::HTTP_BAD_REQUEST,
            'errorCode' => CountryException::COUNTRY_NOT_FOUND,
            'message' => 'Country with id "id-1" not found.',
        ];

        yield CountryException::COUNTRY_STATE_NOT_FOUND => [
            'exception' => CountryException::countryStateNotFound('id-1'),
            'statusCode' => Response::HTTP_BAD_REQUEST,
            'errorCode' => CountryException::COUNTRY_STATE_NOT_FOUND,
            'message' => 'Country state with id "id-1" not found.',
        ];
    }
}
'message' => 'No context data found for SalesChannel "myCustomScn"',
        ];

        yield SalesChannelException::COUNTRY_DOES_NOT_EXISTS_EXCEPTION => [
            'exception' => SalesChannelException::countryNotFound('myCustomCountry'),
            'statusCode' => Response::HTTP_NOT_FOUND,
            'errorCode' => SalesChannelException::COUNTRY_DOES_NOT_EXISTS_EXCEPTION,
            'message' => 'Country with id "myCustomCountry" not found!.',
        ];

        yield SalesChannelException::COUNTRY_STATE_DOES_NOT_EXISTS_EXCEPTION => [
            'exception' => SalesChannelException::countryStateNotFound('myCustomCountryState'),
            'statusCode' => Response::HTTP_NOT_FOUND,
            'errorCode' => SalesChannelException::COUNTRY_STATE_DOES_NOT_EXISTS_EXCEPTION,
            'message' => 'Country state with id "myCustomCountryState" not found!.',
        ];

        yield SalesChannelException::CURRENCY_DOES_NOT_EXISTS_EXCEPTION => [
            'exception' => SalesChannelException::currencyNotFound('myCustomCurrency'),
            'statusCode' => Response::HTTP_NOT_FOUND,
            'errorCode' => SalesChannelException::CURRENCY_DOES_NOT_EXISTS_EXCEPTION,
            'message' => 'Currency with id "myCustomCurrency" not found!.',
        ];

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