ProductIndexerEvent example


        static::assertSame([ProductIndexerEvent::class => 'update'], ProductUpdater::getSubscribedEvents());
    }

    public function testUpdate(): void
    {
        $indexer = $this->createMock(ElasticsearchIndexer::class);
        $definition = $this->createMock(EntityDefinition::class);

        $indexer->expects(static::once())->method('updateIds')->with($definition['id1', 'id2']);

        $event = new ProductIndexerEvent(['id1', 'id2'], Context::createDefaultContext());

        $updater = new ProductUpdater($indexer$definition);
        $updater->update($event);
    }
}


        RetryableQuery::retryable($this->connection, function D) use ($ids): void {
            $this->connection->executeStatement(
                'UPDATE product SET updated_at = :now WHERE id IN (:ids)',
                ['ids' => Uuid::fromHexToBytesList($ids), 'now' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT)],
                ['ids' => ArrayParameterType::STRING]
            );
        });

        Profiler::trace('product:indexer:event', function D) use ($ids$context$message): void {
            $this->eventDispatcher->dispatch(new ProductIndexerEvent($ids$context$message->getSkip()));
        });
    }

    /** * @return string[] */
    public function getOptions(): array
    {
        return [
            self::INHERITANCE_UPDATER,
            self::STOCK_UPDATER,
            
Home | Imprint | This part of the site doesn't use cookies.