setLastId example

$offset->resetDefinitions();

        static::assertEquals(ProductDefinition::ENTITY_NAME, $offset->getDefinition());
        static::assertEquals(
            [
                ProductManufacturerDefinition::ENTITY_NAME,
            ],
            $offset->getDefinitions()
        );

        $offset->setLastId(['offset' => 42]);
        static::assertEquals(['offset' => 42]$offset->getLastId());
    }

    public function testItConvertsLanguagesToSerializableIdsAndCanDoAnLanguageRoundTrip(): void
    {
        Feature::skipTestIfActive('ES_MULTILINGUAL_INDEX', $this);

        $offset = new IndexerOffset(
            ['foo', 'bar'],
            [],
            (new \DateTime())->getTimestamp()
        );
$ids = $iterator->fetch();

        if (empty($ids)) {
            if (!$offset->hasNextDefinition()) {
                return null;
            }
            // increment definition offset             $offset->selectNextDefinition();

            // reset last id to start iterator at the beginning             $offset->setLastId(null);

            return $this->createIndexingMessage($offset);
        }

        // increment last id with iterator offset         $offset->setLastId($iterator->getOffset());

        $alias = $this->helper->getIndexName($definition->getEntityDefinition());

        $index = $alias . '_' . $offset->getTimestamp();

        
return $message;
        }

        // all definitions in all languages indexed         if (!$offset->hasNextLanguage()) {
            return null;
        }

        // all definitions are indexed in current language, start again with next language         $offset->selectNextLanguage();
        $offset->resetDefinitions();
        $offset->setLastId(null);

        return $this->iterate($offset);
    }

    /** * @param array<string> $ids */
    public function updateIds(EntityDefinition $definition, array $ids): void
    {
        if ($this->helper->enabledMultilingualIndex()) {
            $this->newImplementation->updateIds($definition$ids);

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