/**
  * Exports images, variants, properties item data and items base to make sure, that the corresponding items data exist.
  */
 protected function export()
 {
     // Query builder
     $QueryBuilder = Shopware()->Models()->createQueryBuilder();
     $QueryBuilder->select('item.id')->from('Shopware\\Models\\Article\\Article', 'item');
     do {
         // Log the chunk
         PlentymarketsLogger::getInstance()->message('Export:Initial:Item', 'Chunk: ' . ($this->currentChunk + 1));
         // Set Limit and Offset
         $QueryBuilder->setFirstResult($this->currentChunk * $this->sizeOfChunk)->setMaxResults($this->sizeOfChunk);
         // Get the items
         $items = $QueryBuilder->getQuery()->getArrayResult();
         //
         $itemsAlreadyExported = 0;
         foreach ($items as $item) {
             try {
                 // If there is a plenty id for this shopware id,
                 // the item has already been exported to plentymarkets
                 PlentymarketsMappingController::getItemByShopwareID($item['id']);
                 //
                 ++$itemsAlreadyExported;
                 // already done
                 continue;
             } catch (PlentymarketsMappingExceptionNotExistant $E) {
             }
             $PlentymarketsExportEntityItem = new PlentymarketsExportEntityItem(Shopware()->Models()->find('Shopware\\Models\\Article\\Article', $item['id']));
             $PlentymarketsExportEntityItem->export();
         }
         // Remember the chunk
         $this->Config->setItemExportLastChunk($this->currentChunk);
         if ($this->maxChunks > 0) {
             // Increase number of chunks if every item has already been exported
             if ($itemsAlreadyExported == $this->sizeOfChunk) {
                 ++$this->maxChunks;
                 PlentymarketsLogger::getInstance()->message('Export:Initial:Item', 'Increasing number of chunks per run to ' . $this->maxChunks . ' since every item of chunk ' . ($this->currentChunk + 1) . ' has already been exported');
             }
             // Quit when the maximum number of chunks is reached
             if (++$this->chunksDone >= $this->maxChunks) {
                 $this->toBeContinued = true;
                 break;
             }
         }
         // Next chunk
         ++$this->currentChunk;
     } while (!empty($items) && count($items) == $this->sizeOfChunk);
 }