Skip to content

Commit c9102ea

Browse files
author
Kopylova,Olga(okopylova)
committed
Merge pull request magento#47 from magento-ogre/MAGETWO-40848-components-from-vendor
[Ogres] Components from vendor
2 parents 8937e8d + 42593ea commit c9102ea

File tree

5 files changed

+40
-21
lines changed

5 files changed

+40
-21
lines changed

app/code/Magento/SampleData/Module/ConfigurableProduct/Setup/Product.php

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
*/
66
namespace Magento\SampleData\Module\ConfigurableProduct\Setup;
77

8-
use Magento\SampleData\Model\SetupInterface;
9-
use Magento\Framework\App\Filesystem\DirectoryList;
8+
use Magento\Framework\Component\ComponentRegistrar;
9+
use Magento\Framework\Filesystem\Directory\ReadFactory;
1010
use Magento\ImportExport\Model\Import;
1111
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
12+
use Magento\SampleData\Model\SetupInterface;
1213

1314
/**
1415
* Setup configurable product
@@ -31,22 +32,28 @@ class Product implements SetupInterface
3132
private $csvSourceFactory;
3233

3334
/**
34-
* @var \Magento\Framework\Filesystem
35+
* @var \Magento\Framework\Filesystem\Directory\ReadFactory
3536
*/
36-
private $filesystem;
37+
private $readFactory;
3738

3839
/**
3940
* @var \Magento\Indexer\Model\Indexer\CollectionFactory
4041
*/
4142
private $indexerCollectionFactory;
4243

44+
/**
45+
* @var \Magento\Framework\Component\ComponentRegistrar
46+
*/
47+
private $componentRegistrar;
48+
4349
/**
4450
* @param \Magento\SampleData\Model\Logger $logger
4551
* @param \Magento\Eav\Model\Config $eavConfig
4652
* @param \Magento\ImportExport\Model\Import $importModel
4753
* @param \Magento\ImportExport\Model\Import\Source\CsvFactory $csvSourceFactory
4854
* @param \Magento\Indexer\Model\Indexer\CollectionFactory $indexerCollectionFactory
49-
* @param \Magento\Framework\Filesystem $filesystem
55+
* @param \Magento\Framework\Filesystem\Directory\ReadFactory $readFactory
56+
* @param \Magento\Framework\Component\ComponentRegistrar $componentRegistrar
5057
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
5158
* @codingStandardsIgnoreStart
5259
*/
@@ -56,14 +63,16 @@ public function __construct(
5663
\Magento\ImportExport\Model\Import $importModel,
5764
\Magento\ImportExport\Model\Import\Source\CsvFactory $csvSourceFactory,
5865
\Magento\Indexer\Model\Indexer\CollectionFactory $indexerCollectionFactory,
59-
\Magento\Framework\Filesystem $filesystem
66+
\Magento\Framework\Filesystem\Directory\ReadFactory $readFactory,
67+
\Magento\Framework\Component\ComponentRegistrar $componentRegistrar
6068
) {
6169
$this->logger = $logger;
6270
$this->eavConfig = $eavConfig;
6371
$this->importModel = $importModel;
6472
$this->csvSourceFactory = $csvSourceFactory;
6573
$this->indexerCollectionFactory = $indexerCollectionFactory;
66-
$this->filesystem = $filesystem;
74+
$this->readFactory = $readFactory;
75+
$this->componentRegistrar = $componentRegistrar;
6776

6877
}
6978
// @codingStandardsIgnoreEnd
@@ -88,13 +97,15 @@ public function run()
8897

8998
$source = $this->csvSourceFactory->create(
9099
[
91-
'file' => 'Magento/SampleData/fixtures/ConfigurableProduct/import-export_products-img.csv',
92-
'directory' => $this->filesystem->getDirectoryWrite(DirectoryList::MODULES)
100+
'file' => 'fixtures/ConfigurableProduct/import-export_products-img.csv',
101+
'directory' => $this->readFactory->create(
102+
$this->componentRegistrar->getPath(ComponentRegistrar::MODULE, 'Magento_SampleData')
103+
)
93104
]
94105
);
95106

96107
$currentPath = getcwd();
97-
chdir($this->filesystem->getDirectoryRead(DirectoryList::ROOT)->getAbsolutePath());
108+
chdir(BP);
98109

99110
$importModel->validateSource($source);
100111
$importModel->importSource();

app/code/Magento/SampleData/composer.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@
33
"description": "Sample Data fixtures",
44
"version": "1.0.0-beta",
55
"require": {
6-
"magento/framework": "~1.0.0-beta",
7-
"magento/magento-composer-installer": "*"
6+
"magento/framework": "~1.0.0-beta"
87
},
98
"type": "magento2-module",
10-
"extra": {
11-
"map": [
12-
[
13-
"*",
14-
"Magento/SampleData"
15-
]
16-
]
9+
"autoload": {
10+
"files": [ "registration.php" ],
11+
"psr-4": {
12+
"Magento\\SampleData\\": ""
13+
}
1714
}
1815
}

app/code/Magento/SampleData/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:library:framework:ObjectManager/etc/config.xsd">
99
<type name="Magento\Framework\Console\CommandList">
1010
<arguments>
1111
<argument name="commands" xsi:type="array">

app/code/Magento/SampleData/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:library:framework:Module/etc/module.xsd">
99
<module name="Magento_SampleData" setup_version="2.0.0">
1010
</module>
1111
</config>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
\Magento\Framework\Component\ComponentRegistrar::register(
8+
\Magento\Framework\Component\ComponentRegistrar::MODULE,
9+
'Magento_SampleData',
10+
__DIR__
11+
);

0 commit comments

Comments
 (0)