StructNotFoundException example

string $baseUrl,
        int $shopId,
        ?int $currencyId = null,
        ?string $currentCustomerGroupKey = null,
        ?int $areaId = null,
        ?int $countryId = null,
        ?int $stateId = null,
        array $streamIds = []
    ): ShopContextInterface {
        $shop = $this->shopGateway->get($shopId);
        if (!$shop instanceof Shop) {
            throw new StructNotFoundException(Shop::class$shopId);
        }
        $fallbackCustomerGroupKey = self::FALLBACK_CUSTOMER_GROUP;

        if ($currentCustomerGroupKey === null) {
            $currentCustomerGroupKey = $fallbackCustomerGroupKey;
        }

        $groups = $this->customerGroupGateway->getList([$currentCustomerGroupKey$fallbackCustomerGroupKey]);

        $currentCustomerGroup = $groups[$currentCustomerGroupKey];
        $fallbackCustomerGroup = $groups[$fallbackCustomerGroupKey];

        

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $shopId = (int) $input->getArgument('shopId');
        $type = $input->getArgument('type');
        $query = $input->getArgument('query');
        $analyzer = $input->getArgument('analyzer');

        $shop = $this->container->get(ShopGatewayInterface::class)->get($shopId);
        if (!$shop instanceof ShopStruct) {
            throw new StructNotFoundException(ShopStruct::class$shopId);
        }
        $client = $this->container->get(Client::class);
        $index = $this->container->get(IndexFactory::class)->createShopIndex($shop$type);

        $analyzed = $client->indices()->analyze([
            'index' => $index->getName(),
            'analyzer' => $analyzer,
            'text' => $query,
        ]);

        $tokens = $analyzed['tokens'];

        


    /** * {@inheritdoc} */
    public function calculateProduct(
        ListProduct $product,
        ShopContextInterface $context
    ) {
        $tax = $context->getTaxRule($product->getTax()->getId());
        if (!$tax instanceof Tax) {
            throw new StructNotFoundException(Tax::class$product->getTax()->getId());
        }

        $rules = $product->getPriceRules();

        $prices = [];
        foreach ($rules as $rule) {
            $prices[] = $this->calculatePriceStruct($rule$tax$context);
        }

        $product->setPrices($prices);

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