/** * {@inheritdoc} */ protected function quickExport() { $productIds = $this->massActionDispatcher->dispatch($this->request); $fieldsList = $this->fieldsBuilder->getFieldsList($productIds); $attributeIds = $this->fieldsBuilder->getAttributeIds(); $context = $this->getContext() + ['fields' => $fieldsList]; // batch output to avoid memory leak $offset = 0; $batchSize = 100; while ($productsList = array_slice($productIds, $offset, $batchSize)) { $results = $this->productRepository->getFullProducts($productsList, $attributeIds); echo $this->serializer->serialize($results, $this->getFormat(), $context); $offset += $batchSize; flush(); } }