Skip to content

Commit 59b234c

Browse files
Merge branch 'ACPT-747-2' into ACPT-757&ACPT-773&ACPT-747&ACPT-748&ACPT-675&ACPT-671&ACPT-746
2 parents 5442f74 + 94f27a8 commit 59b234c

File tree

4 files changed

+18
-147
lines changed

4 files changed

+18
-147
lines changed

app/code/Magento/ImportExport/Model/Import/Adapter.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66
namespace Magento\ImportExport\Model\Import;
77

88
use Magento\Framework\Filesystem\Directory\Write;
9-
use Magento\ImportExport\Model\Import\Source\Factory;
109

1110
/**
1211
* Import adapter model
13-
* @Deprecated
14-
* @see \Magento\ImportExport\Model\Import\Source\Factory
1512
* @author Magento Core Team <core@magentocommerce.com>
1613
*/
1714
class Adapter

app/code/Magento/ImportExport/Model/Import/Source/Base64EncodedCsvData.php

Lines changed: 0 additions & 62 deletions
This file was deleted.

app/code/Magento/ImportExport/Model/Import/Source/Csv.php

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
*/
66
namespace Magento\ImportExport\Model\Import\Source;
77

8-
use Magento\Framework\Filesystem\Directory\Read;
8+
use Magento\Framework\Filesystem\Directory\Read as DirectoryRead;
9+
use Magento\Framework\Filesystem\File\ReadInterface as FileReadInterface;
910

1011
/**
1112
* CSV import adapter
1213
*/
1314
class Csv extends \Magento\ImportExport\Model\Import\AbstractSource
1415
{
1516
/**
16-
* @var \Magento\Framework\Filesystem\File\Write
17+
* @var FileReadInterface
1718
*/
1819
protected $_file;
1920

@@ -42,27 +43,33 @@ class Csv extends \Magento\ImportExport\Model\Import\AbstractSource
4243
*
4344
* There must be column names in the first line
4445
*
45-
* @param string $file
46-
* @param Read $directory
46+
* @param string|FileReadInterface $file
47+
* @param DirectoryRead $directory
4748
* @param string $delimiter
4849
* @param string $enclosure
4950
* @throws \LogicException
5051
*/
5152
public function __construct(
5253
$file,
53-
Read $directory,
54+
DirectoryRead $directory,
5455
$delimiter = ',',
5556
$enclosure = '"'
5657
) {
5758
// phpcs:ignore Magento2.Functions.DiscouragedFunction
5859
register_shutdown_function([$this, 'destruct']);
59-
try {
60-
$this->filePath = $directory->getRelativePath($file);
61-
$this->_file = $directory->openFile($this->filePath, 'r');
60+
if ($file instanceof FileReadInterface) {
61+
$this->filePath = '';
62+
$this->_file = $file;
6263
$this->_file->seek(0);
63-
self::$openFiles[$this->filePath] = true;
64-
} catch (\Magento\Framework\Exception\FileSystemException $e) {
65-
throw new \LogicException("Unable to open file: '{$file}'");
64+
} else {
65+
try {
66+
$this->filePath = $directory->getRelativePath($file);
67+
$this->_file = $directory->openFile($this->filePath, 'r');
68+
$this->_file->seek(0);
69+
self::$openFiles[$this->filePath] = true;
70+
} catch (\Magento\Framework\Exception\FileSystemException $e) {
71+
throw new \LogicException("Unable to open file: '{$file}'");
72+
}
6673
}
6774
if ($delimiter) {
6875
$this->_delimiter = $delimiter;

app/code/Magento/ImportExport/Model/Import/Source/Factory.php

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)