/**
  * @return self
  */
 public function saveIndex($dimensions, \Traversable $documents)
 {
     foreach ($this->batch->getItems($documents, $this->batchSize) as $documentsBatch) {
         $bulkData = $this->adapter->prepareDataForBulkUpdate($documentsBatch, $dimensions);
         $this->adapter->addDataBulk($bulkData);
     }
     return $this;
 }
 /**
  * {@inheritdoc}
  */
 public function deleteIndex($dimensions, \Traversable $documents)
 {
     foreach ($this->dataTypes as $dataType) {
         foreach ($this->batch->getItems($documents, $this->batchSize) as $batchDocuments) {
             $documentsId = array_column($batchDocuments, 'id');
             $this->connection->delete($this->getTableName($dataType, $dimensions), ['id' => $documentsId]);
         }
     }
 }
 /**
  * {@inheritDoc}
  */
 public function deleteIndex($dimensions, \Traversable $documents)
 {
     foreach ($dimensions as $dimension) {
         $storeId = $dimension->getValue();
         $index = $this->indexOperation->getIndexByName($this->indexName, $storeId);
         $type = $index->getType($this->typeName);
         foreach ($this->batch->getItems($documents, $this->batchSize) as $batchDocuments) {
             $bulk = $this->indexOperation->createBulk()->deleteDocuments($index, $type, $batchDocuments);
             $this->indexOperation->executeBulk($bulk);
         }
         $this->indexOperation->refreshIndex($index);
     }
     return $this;
 }
 /**
  * {@inheritdoc}
  */
 public function deleteIndex($dimensions, \Traversable $documents)
 {
     foreach ($this->batch->getItems($documents, $this->batchSize) as $batchDocuments) {
         $this->resource->getConnection()->delete($this->getTableName($dimensions), ['entity_id in (?)' => $batchDocuments]);
     }
 }
Beispiel #5
0
 /**
  * @param array $itemsData
  * @param int $size
  * @param array $expected
  *
  * @dataProvider getItemsDataProvider
  */
 public function testGetItems(array $itemsData, $size, array $expected)
 {
     $items = new \ArrayObject($itemsData);
     $this->assertSame($expected, $this->object->getItems($items, $size));
 }