Skip to content

Commit

Permalink
Merge pull request #288 from magento-dragons/MAGETWO-36702
Browse files Browse the repository at this point in the history
MAGETWO-36702  [GITHUB] Can't install sample data #1216
  • Loading branch information
Klymenko, Volodymyr(vklymenko) committed May 14, 2015
2 parents 271aec2 + a3267b4 commit e98a487
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions setup/src/Magento/Setup/Model/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
11 changes: 4 additions & 7 deletions setup/src/Magento/Setup/Model/SampleData.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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);
}
}

0 comments on commit e98a487

Please sign in to comment.