createProductSearchKeyword example

$now = new \DateTimeImmutable();
        $ids = new IdsCollection();
        $context = Context::createDefaultContext();

        $product = (new ProductBuilder($ids, 'test'))->price(100)->build();

        $this->getContainer()->get('product.repository')->create([$product]$context);

        $this->getContainer()->get(Connection::class)->executeStatement('DELETE FROM product_keyword_dictionary');

        $productId = Uuid::fromHexToBytes($product['id']);
        $this->createProductSearchKeyword('test 1', $productId$now$context);
        $this->createProductSearchKeyword('test 2', $productId$now$context);

        $this->createProductKeywordDictionary('test 1');
        $this->createProductKeywordDictionary('test 2');
        $this->createProductKeywordDictionary('test 3');
        $this->createProductKeywordDictionary('test 4');

        $this->handler->run();

        $keywordDictionaries = $this->getContainer()->get(Connection::class)
            ->fetchFirstColumn('SELECT keyword FROM product_keyword_dictionary');

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