From 5c0297f266b4f55f4638ddcaca8675de3496e266 Mon Sep 17 00:00:00 2001 From: Volodymyr klymenko Date: Wed, 13 May 2015 15:16:56 +0300 Subject: [PATCH] MAGETWO-36702: [GITHUB] Can't install sample data #1216 --- setup/src/Magento/Setup/Model/Installer.php | 1 + setup/src/Magento/Setup/Model/SampleData.php | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php index 35f3a6fed1489..7dd717f0c4a72 100644 --- a/setup/src/Magento/Setup/Model/Installer.php +++ b/setup/src/Magento/Setup/Model/Installer.php @@ -1120,6 +1120,7 @@ private function assertDbAccessible() private function installSampleData($request) { $userName = isset($request[AdminAccount::KEY_USER]) ? $request[AdminAccount::KEY_USER] : ''; + $this->objectManagerProvider->reset(); $this->sampleData->install($this->objectManagerProvider->get(), $this->log, $userName); } diff --git a/setup/src/Magento/Setup/Model/SampleData.php b/setup/src/Magento/Setup/Model/SampleData.php index f01948c53323b..0e9e4eaeea9b9 100644 --- a/setup/src/Magento/Setup/Model/SampleData.php +++ b/setup/src/Magento/Setup/Model/SampleData.php @@ -50,11 +50,11 @@ public function isDeployed() * * @param ObjectManagerInterface $objectManager * @param LoggerInterface $logger - * @param string $adminUserName + * @param string $userName * @throws \Exception * @return void */ - public function install(ObjectManagerInterface $objectManager, LoggerInterface $logger, $adminUserName) + public function install(ObjectManagerInterface $objectManager, LoggerInterface $logger, $userName) { /** @var \Magento\Tools\SampleData\Logger $sampleDataLogger */ $sampleDataLogger = $objectManager->get('Magento\Tools\SampleData\Logger'); @@ -68,11 +68,8 @@ public function install(ObjectManagerInterface $objectManager, LoggerInterface $ $configLoader = $objectManager->get('Magento\Framework\App\ObjectManager\ConfigLoader'); $objectManager->configure($configLoader->load($areaCode)); - /** @var \Magento\User\Model\UserFactory $userFactory */ - $userFactory = $objectManager->get('Magento\User\Model\UserFactory'); - $user = $userFactory->create()->loadByUsername($adminUserName); - + /** @var \Magento\Tools\SampleData\Installer $installer */ $installer = $objectManager->get('Magento\Tools\SampleData\Installer'); - $installer->run($user); + $installer->run($userName); } }