$context =
$this->contextService->
get($contextServiceParameters);
// Validate if a customer login is required for the current request
$this->
validateLogin($request,
$context);
// Update attributes and headers of the current request
$request->attributes->
set(PlatformRequest::ATTRIBUTE_CONTEXT_OBJECT,
$context->
getContext());
$request->attributes->
set(PlatformRequest::ATTRIBUTE_SALES_CHANNEL_CONTEXT_OBJECT,
$context);
$request->headers->
set(PlatformRequest::HEADER_CONTEXT_TOKEN,
$context->
getToken());
$this->eventDispatcher->
dispatch( new SalesChannelContextResolvedEvent($context,
$usedContextToken) );
} public function handleSalesChannelContext(Request
$request, string
$salesChannelId, string
$contextToken): void
{ $language =
$request->headers->
get(PlatformRequest::HEADER_LANGUAGE_ID
);
$currencyId =
$request->attributes->
get(SalesChannelRequest::ATTRIBUTE_DOMAIN_CURRENCY_ID
);
$context =
$this->contextService
->
get(new SalesChannelContextServiceParameters($salesChannelId,
$contextToken,
$language,
$currencyId));