noContextData example

'message' => 'Sales channel with id "myCustomScn" not found or not valid!.',
        ];

        yield SalesChannelException::LANGUAGE_INVALID_EXCEPTION => [
            'exception' => SalesChannelException::invalidLanguageId(),
            'statusCode' => Response::HTTP_PRECONDITION_FAILED,
            'errorCode' => SalesChannelException::LANGUAGE_INVALID_EXCEPTION,
            'message' => 'Provided languageId is not a valid uuid',
        ];

        yield SalesChannelException::NO_CONTEXT_DATA_EXCEPTION => [
            'exception' => SalesChannelException::noContextData('myCustomScn'),
            'statusCode' => Response::HTTP_PRECONDITION_FAILED,
            'errorCode' => SalesChannelException::NO_CONTEXT_DATA_EXCEPTION,
            '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!.',
        ];

        


        $data = $this->connection->fetchAssociative($sql[
            'id' => Uuid::fromHexToBytes($salesChannelId),
        ]);
        if ($data === false) {
            throw SalesChannelException::noContextData($salesChannelId);
        }

        if (isset($session[SalesChannelContextService::ORIGINAL_CONTEXT])) {
            $origin = new AdminSalesChannelApiSource($salesChannelId$session[SalesChannelContextService::ORIGINAL_CONTEXT]);
        } else {
            $origin = new SalesChannelApiSource($salesChannelId);
        }

        // explode all available languages for the provided sales channel         $languageIds = $data['sales_channel_language_ids'] ? explode(',', (string) $data['sales_channel_language_ids']) : [];
        $languageIds = array_keys(array_flip($languageIds));

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