/**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @throws \Magento\Framework\Exception\LocalizedException
  * @return null|int null or 0 if everything went fine, or an error code
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $omParams = $_SERVER;
     $omParams[StoreManager::PARAM_RUN_CODE] = 'admin';
     $omParams[Store::CUSTOM_ENTRY_POINT_PARAM] = true;
     $this->objectManager = $this->objectManagerFactory->create($omParams);
     $area = FrontNameResolver::AREA_CODE;
     /** @var \Magento\Framework\App\State $appState */
     $appState = $this->objectManager->get('Magento\\Framework\\App\\State');
     $appState->setAreaCode($area);
     $configLoader = $this->objectManager->get('Magento\\Framework\\ObjectManager\\ConfigLoaderInterface');
     $this->objectManager->configure($configLoader->load($area));
     $output->writeln('Import started');
     $time = microtime(true);
     /** @var \FireGento\FastSimpleImport\Model\Importer $importerModel */
     $importerModel = $this->objectManager->create('FireGento\\FastSimpleImport\\Model\\Importer');
     $productsArray = $this->getEntities();
     $importerModel->setBehavior($this->getBehavior());
     $importerModel->setEntityCode($this->getEntityCode());
     $adapterFactory = $this->objectManager->create('FireGento\\FastSimpleImport\\Model\\Adapters\\NestedArrayAdapterFactory');
     $importerModel->setImportAdapterFactory($adapterFactory);
     try {
         $importerModel->processImport($productsArray);
     } catch (\Exception $e) {
         $output->writeln($e->getMessage());
     }
     $output->write($importerModel->getLogTrace());
     $output->write($importerModel->getErrorMessages());
     $output->writeln('Import finished. Elapsed time: ' . round(microtime(true) - $time, 2) . 's' . "\n");
     $this->afterFinishImport();
 }
 protected function setUp()
 {
     $autoloadWrapper = \Magento\Framework\Autoload\AutoloaderRegistry::getAutoloader();
     $autoloadWrapper->addPsr4('Magento\\Wonderland\\', realpath(__DIR__ . '/_files/Magento/Wonderland'));
     $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
     $this->_objectManager->configure(['preferences' => ['Magento\\Wonderland\\Api\\Data\\FakeAddressInterface' => 'Magento\\Wonderland\\Model\\FakeAddress', 'Magento\\Wonderland\\Api\\Data\\FakeRegionInterface' => 'Magento\\Wonderland\\Model\\FakeRegion']]);
 }
 public static function setUpBeforeClass()
 {
     $config = new \Magento\Framework\ObjectManager\Config\Config();
     $factory = new Factory\Dynamic\Developer($config);
     self::$_objectManager = new \Magento\Framework\ObjectManager\ObjectManager($factory, $config);
     self::$_objectManager->configure(['preferences' => [self::TEST_INTERFACE => self::TEST_INTERFACE_IMPLEMENTATION]]);
     $factory->setObjectManager(self::$_objectManager);
 }
 /**
  * Retrieve object manager.
  *
  * @return ObjectManagerInterface
  * @throws \Magento\Setup\Exception
  */
 public function get()
 {
     if (null === $this->objectManager) {
         $initParams = $this->serviceLocator->get(InitParamListener::BOOTSTRAP_PARAM);
         $factory = Bootstrap::createObjectManagerFactory(BP, $initParams);
         $this->objectManager = $factory->create($initParams);
         $this->objectManager->configure(['Magento\\Framework\\Stdlib\\DateTime\\Timezone' => ['arguments' => ['scopeType' => \Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT]]]);
     }
     return $this->objectManager;
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  **/
 public function launch()
 {
     $areaCode = 'adminhtml';
     $this->appState->setAreaCode($areaCode);
     $this->objectManager->configure($this->configLoader->load($areaCode));
     /** @var \Magento\Tools\SampleData\Logger $sampleDataLogger */
     $sampleDataLogger = $this->objectManager->get('Magento\\Tools\\SampleData\\Logger');
     $sampleDataLogger->setSubject($this->objectManager->get('Magento\\Setup\\Model\\ConsoleLogger'));
     $this->installer->run($this->userFactory->create()->loadByUsername($this->adminUserName));
     return $this->response;
 }
Ejemplo n.º 6
0
 /**
  * Run application
  *
  * @return ResponseInterface
  */
 public function launch()
 {
     $this->_state->setAreaCode(Area::AREA_CRONTAB);
     $configLoader = $this->objectManager->get('Magento\\Framework\\ObjectManager\\ConfigLoaderInterface');
     $this->objectManager->configure($configLoader->load(Area::AREA_CRONTAB));
     /** @var \Magento\Framework\Event\ManagerInterface $eventManager */
     $eventManager = $this->objectManager->get('Magento\\Framework\\Event\\ManagerInterface');
     $eventManager->dispatch('default');
     $this->_response->setCode(0);
     return $this->_response;
 }
 /**
  * Gets initialized object manager
  *
  * @return ObjectManagerInterface
  */
 protected function getObjectManager()
 {
     if (null == $this->objectManager) {
         $area = FrontNameResolver::AREA_CODE;
         $this->objectManager = $this->objectManagerFactory->create($_SERVER);
         /** @var \Magento\Framework\App\State $appState */
         $appState = $this->objectManager->get('Magento\\Framework\\App\\State');
         $appState->setAreaCode($area);
         $configLoader = $this->objectManager->get('Magento\\Framework\\ObjectManager\\ConfigLoaderInterface');
         $this->objectManager->configure($configLoader->load($area));
     }
     return $this->objectManager;
 }
Ejemplo n.º 8
0
 /**
  * {@inheritdoc}
  * @throws \InvalidArgumentException
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $locale = $input->getOption(self::LOCALE_OPTION);
     if (!$this->validator->isValid($locale)) {
         throw new \InvalidArgumentException($locale . ' argument has invalid value, please run info:language:list for list of available locales');
     }
     $area = $input->getOption(self::AREA_OPTION);
     $theme = $input->getOption(self::THEME_OPTION);
     $type = $input->getArgument(self::TYPE_ARGUMENT);
     $this->state->setAreaCode($area);
     $this->objectManager->configure($this->configLoader->load($area));
     $sourceFileGenerator = $this->sourceFileGeneratorPool->create($type);
     foreach ($input->getArgument(self::FILE_ARGUMENT) as $file) {
         $file .= '.' . $type;
         $output->writeln("<info>Gathering {$file} sources.</info>");
         $asset = $this->assetRepo->createAsset($file, ['area' => $area, 'theme' => $theme, 'locale' => $locale]);
         $rootDir = $this->filesystem->getDirectoryWrite(DirectoryList::ROOT);
         $sourceFile = $this->assetSource->findSource($asset);
         $relativePath = $rootDir->getRelativePath($sourceFile);
         $content = $rootDir->readFile($relativePath);
         $chain = $this->chainFactory->create(['asset' => $asset, 'origContent' => $content, 'origContentType' => $asset->getContentType(), 'origAssetPath' => $relativePath]);
         $processedCoreFile = $sourceFileGenerator->generateFileTree($chain);
         $targetDir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
         $source = $rootDir->getRelativePath($processedCoreFile);
         $destination = $asset->getPath();
         $rootDir->copyFile($source, $destination, $targetDir);
         $output->writeln("<info>Successfully processed dynamic stylesheet into CSS</info>");
     }
 }
Ejemplo n.º 9
0
 /**
  * Launch application
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function launch()
 {
     $this->objectManager->configure(['preferences' => ['Magento\\Tools\\Di\\Compiler\\Config\\WriterInterface' => 'Magento\\Tools\\Di\\Compiler\\Config\\Writer\\Filesystem', 'Magento\\Tools\\Di\\Compiler\\Log\\Writer\\WriterInterface' => 'Magento\\Tools\\Di\\Compiler\\Log\\Writer\\Console'], 'Magento\\Tools\\Di\\Compiler\\Config\\ModificationChain' => ['arguments' => ['modificationsList' => ['BackslashTrim' => ['instance' => 'Magento\\Tools\\Di\\Compiler\\Config\\Chain\\BackslashTrim'], 'PreferencesResolving' => ['instance' => 'Magento\\Tools\\Di\\Compiler\\Config\\Chain\\PreferencesResolving'], 'InterceptorSubstitution' => ['instance' => 'Magento\\Tools\\Di\\Compiler\\Config\\Chain\\InterceptorSubstitution'], 'InterceptionPreferencesResolving' => ['instance' => 'Magento\\Tools\\Di\\Compiler\\Config\\Chain\\PreferencesResolving'], 'ArgumentsSerialization' => ['instance' => 'Magento\\Tools\\Di\\Compiler\\Config\\Chain\\ArgumentsSerialization']]]], 'Magento\\Tools\\Di\\Code\\Generator\\PluginList' => ['arguments' => ['cache' => ['instance' => 'Magento\\Framework\\App\\Interception\\Cache\\CompiledConfig']]], 'Magento\\Tools\\Di\\Code\\Reader\\ClassesScanner' => ['arguments' => ['excludePatterns' => $this->excludedPathsList]]]);
     $operations = [Task\OperationFactory::REPOSITORY_GENERATOR => ['path' => $this->compiledPathsList['application'], 'filePatterns' => ['di' => '/\\/etc\\/([a-zA-Z_]*\\/di|di)\\.xml$/']], Task\OperationFactory::APPLICATION_CODE_GENERATOR => [$this->compiledPathsList['application'], $this->compiledPathsList['library'], $this->compiledPathsList['generated_helpers']], Task\OperationFactory::INTERCEPTION => ['intercepted_paths' => [$this->compiledPathsList['application'], $this->compiledPathsList['library'], $this->compiledPathsList['generated_helpers']], 'path_to_store' => $this->compiledPathsList['generated_helpers']], Task\OperationFactory::AREA_CONFIG_GENERATOR => [$this->compiledPathsList['application'], $this->compiledPathsList['library'], $this->compiledPathsList['generated_helpers']], Task\OperationFactory::INTERCEPTION_CACHE => [$this->compiledPathsList['application'], $this->compiledPathsList['library'], $this->compiledPathsList['generated_helpers']]];
     $responseCode = Response::SUCCESS;
     try {
         foreach ($operations as $operationCode => $arguments) {
             $this->taskManager->addOperation($operationCode, $arguments);
         }
         $this->taskManager->process();
     } catch (Task\OperationException $e) {
         $responseCode = Response::ERROR;
         $this->response->setBody($e->getMessage());
     }
     $this->response->setCode($responseCode);
     return $this->response;
 }
Ejemplo n.º 10
0
 /**
  * Getter for ObjectManager
  *
  * @return \Magento\Framework\ObjectManagerInterface
  */
 public function getObjectManager()
 {
     if (!$this->objectManager) {
         $this->objectManager = $this->initObjectManager();
     }
     $this->objectManager->configure(['preferences' => ['Migration\\App\\ProgressBar\\LogLevelProcessor' => 'Migration\\TestFramework\\ProgressBar'], 'Migration\\Logger\\Logger' => ['arguments' => ['handlers' => ['quiet' => ['instance' => '\\Migration\\TestFramework\\QuietLogHandler']]]]]);
     return $this->objectManager;
 }
Ejemplo n.º 11
0
 /**
  * Launch application
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function launch()
 {
     $this->objectManager->configure(['preferences' => ['Magento\\Tools\\Di\\Compiler\\Config\\WriterInterface' => 'Magento\\Tools\\Di\\Compiler\\Config\\Writer\\Filesystem']]);
     $operations = [Task\OperationFactory::AREA => [BP . '/' . 'app/code', BP . '/' . 'lib/internal/Magento/Framework', BP . '/' . 'var/generation'], Task\OperationFactory::INTERCEPTION => BP . '/var/generation', Task\OperationFactory::INTERCEPTION_CACHE => [BP . '/' . 'app/code', BP . '/' . 'lib/internal/Magento/Framework', BP . '/' . 'var/generation']];
     $responseCode = Response::SUCCESS;
     try {
         foreach ($operations as $operationCode => $arguments) {
             $this->taskManager->addOperation($operationCode, $arguments);
         }
         $this->taskManager->process();
     } catch (Task\OperationException $e) {
         $responseCode = Response::ERROR;
         $this->response->setBody($e->getMessage());
     }
     $this->response->setCode($responseCode);
     return $this->response;
 }
Ejemplo n.º 12
0
 /**
  * Sets area code to start a session for replication.
  * TODO: move \Praxigento\App\Generic2\Console\Command\Init\Base into the Core
  */
 private function _setAreaCode()
 {
     /* Magento related config (Object Manager) */
     /** @var \Magento\Framework\App\State $appState */
     $appState = $this->_manObj->get(\Magento\Framework\App\State::class);
     try {
         /* area code should be set only once */
         $appState->getAreaCode();
     } catch (\Magento\Framework\Exception\LocalizedException $e) {
         /* exception will be thrown if no area code is set */
         $areaCode = 'adminhtml';
         $appState->setAreaCode($areaCode);
         /** @var \Magento\Framework\ObjectManager\ConfigLoaderInterface $configLoader */
         $configLoader = $this->_manObj->get(\Magento\Framework\ObjectManager\ConfigLoaderInterface::class);
         $config = $configLoader->load($areaCode);
         $this->_manObj->configure($config);
     }
 }
Ejemplo n.º 13
0
 /**
  * Sets area code to start a session for database backup and rollback
  *
  * @return void
  */
 private function setAreaCode()
 {
     $areaCode = 'adminhtml';
     /** @var \Magento\Framework\App\State $appState */
     $appState = $this->objectManager->get('Magento\\Framework\\App\\State');
     $appState->setAreaCode($areaCode);
     /** @var \Magento\Framework\ObjectManager\ConfigLoaderInterface $configLoader */
     $configLoader = $this->objectManager->get('Magento\\Framework\\ObjectManager\\ConfigLoaderInterface');
     $this->objectManager->configure($configLoader->load($areaCode));
 }
Ejemplo n.º 14
0
 /**
  * Finds requested resource and provides it to the client
  *
  * @return \Magento\Framework\App\ResponseInterface
  * @throws \Exception
  */
 public function launch()
 {
     // disabling profiling when retrieving static resource
     \Magento\Framework\Profiler::reset();
     $appMode = $this->state->getMode();
     if ($appMode == \Magento\Framework\App\State::MODE_PRODUCTION) {
         $this->response->setHttpResponseCode(404);
     } else {
         $path = $this->request->get('resource');
         $params = $this->parsePath($path);
         $this->state->setAreaCode($params['area']);
         $this->objectManager->configure($this->configLoader->load($params['area']));
         $file = $params['file'];
         unset($params['file']);
         $asset = $this->assetRepo->createAsset($file, $params);
         $this->response->setFilePath($asset->getSourceFile());
         $this->publisher->publish($asset);
     }
     return $this->response;
 }
Ejemplo n.º 15
0
 /**
  * Sets area code to start a adminhtml session and configure Object Manager.
  */
 protected function configure()
 {
     parent::configure();
     /* UI related config (Symfony) */
     $this->setName($this->_cmdName);
     $this->setDescription($this->_cmdDesc);
     /* Magento related config (Object Manager) */
     /** @var \Magento\Framework\App\State $appState */
     $appState = $this->_manObj->get(\Magento\Framework\App\State::class);
     try {
         /* area code should be set only once */
         $appState->getAreaCode();
     } catch (\Magento\Framework\Exception\LocalizedException $e) {
         /* exception will be thrown if no area code is set */
         $areaCode = \Magento\Framework\App\Area::AREA_FRONTEND;
         $appState->setAreaCode($areaCode);
         /** @var \Magento\Framework\ObjectManager\ConfigLoaderInterface $configLoader */
         $configLoader = $this->_manObj->get(\Magento\Framework\ObjectManager\ConfigLoaderInterface::class);
         $config = $configLoader->load($areaCode);
         $this->_manObj->configure($config);
     }
 }
Ejemplo n.º 16
0
 /**
  * Emulate application area and various services that are necessary for populating files
  *
  * @param string $areaCode
  * @return void
  */
 private function emulateApplicationArea($areaCode)
 {
     $this->objectManager = $this->omFactory->create([\Magento\Framework\App\State::PARAM_MODE => \Magento\Framework\App\State::MODE_DEFAULT]);
     /** @var \Magento\Framework\App\State $appState */
     $appState = $this->objectManager->get('Magento\\Framework\\App\\State');
     $appState->setAreaCode($areaCode);
     /** @var \Magento\Framework\App\ObjectManager\ConfigLoader $configLoader */
     $configLoader = $this->objectManager->get('Magento\\Framework\\App\\ObjectManager\\ConfigLoader');
     $this->objectManager->configure($configLoader->load($areaCode));
     $this->assetRepo = $this->objectManager->get('Magento\\Framework\\View\\Asset\\Repository');
     $this->assetPublisher = $this->objectManager->create('Magento\\Framework\\App\\View\\Asset\\Publisher');
     $this->htmlMinifier = $this->objectManager->get('Magento\\Framework\\View\\Template\\Html\\MinifierInterface');
     $this->bundleManager = $this->objectManager->get('Magento\\Framework\\View\\Asset\\Bundle\\Manager');
 }
 private function _setAreaCode()
 {
     /** @var \Magento\Framework\App\State $appState */
     $appState = $this->_manObj->get(\Magento\Framework\App\State::class);
     try {
         $appState->getAreaCode();
     } catch (\Exception $e) {
         $areaCode = 'adminhtml';
         $appState->setAreaCode($areaCode);
         /** @var \Magento\Framework\ObjectManager\ConfigLoaderInterface $configLoader */
         $configLoader = $this->_manObj->get(\Magento\Framework\ObjectManager\ConfigLoaderInterface::class);
         $config = $configLoader->load($areaCode);
         $this->_manObj->configure($config);
     }
 }
 /**
  * Installation routine for creating sample data
  *
  * @param ObjectManagerInterface $objectManager
  * @param LoggerInterface $logger
  * @param string $userName
  * @param array $modules
  * @throws \Exception
  * @return void
  */
 public function install(ObjectManagerInterface $objectManager, LoggerInterface $logger, $userName, array $modules = [])
 {
     /** @var \Magento\SampleData\Model\Logger $sampleDataLogger */
     $sampleDataLogger = $objectManager->get('Magento\\SampleData\\Model\\Logger');
     $sampleDataLogger->setSubject($logger);
     $areaCode = 'adminhtml';
     /** @var \Magento\Framework\App\State $appState */
     $appState = $objectManager->get('Magento\\Framework\\App\\State');
     $appState->setAreaCode($areaCode);
     /** @var \Magento\Framework\ObjectManager\ConfigLoaderInterface $configLoader */
     $configLoader = $objectManager->get('Magento\\Framework\\ObjectManager\\ConfigLoaderInterface');
     $objectManager->configure($configLoader->load($areaCode));
     /** @var \Magento\SampleData\Model\Installer $installer */
     $installer = $objectManager->get('Magento\\SampleData\\Model\\Installer');
     $installer->run($userName, $modules);
 }
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  * @return null|int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     try {
         $area = $this->appState->getAreaCode();
         if ($area != Area::AREA_ADMINHTML) {
             $this->appState->setAreaCode(Area::AREA_ADMINHTML);
         }
     } catch (\Magento\Framework\Exception\LocalizedException $e) {
         $this->appState->setAreaCode(Area::AREA_ADMINHTML);
     }
     $area = $this->appState->getAreaCode();
     $configLoader = $this->objectManager->get('Magento\\Framework\\ObjectManager\\ConfigLoaderInterface');
     $this->objectManager->configure($configLoader->load($area));
     $this->registry->register('isSecureArea', true);
 }
Ejemplo n.º 20
0
 /**
  * Installation routine for creating sample data
  *
  * @param ObjectManagerInterface $objectManager
  * @param LoggerInterface $logger
  * @param $adminUserName
  * @throws \Exception
  */
 public function install(ObjectManagerInterface $objectManager, LoggerInterface $logger, $adminUserName)
 {
     /** @var \Magento\Tools\SampleData\Logger $sampleDataLogger */
     $sampleDataLogger = $objectManager->get('Magento\\Tools\\SampleData\\Logger');
     $sampleDataLogger->setSubject($logger);
     $areaCode = 'adminhtml';
     /** @var \Magento\Framework\App\State $appState */
     $appState = $objectManager->get('Magento\\Framework\\App\\State');
     $appState->setAreaCode($areaCode);
     /** @var \Magento\Framework\App\ObjectManager\ConfigLoader $configLoader */
     $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);
     $installer = $objectManager->get('Magento\\Tools\\SampleData\\Installer');
     $installer->run($user);
 }
Ejemplo n.º 21
0
 /**
  * Configure Object Manager
  *
  * @param OutputInterface $output
  * @return void
  */
 private function configureObjectManager(OutputInterface $output)
 {
     $this->objectManager->configure(
         [
             'preferences' => [
                 'Magento\Setup\Module\Di\Compiler\Config\WriterInterface' =>
                     'Magento\Setup\Module\Di\Compiler\Config\Writer\Filesystem',
             ],
             'Magento\Setup\Module\Di\Compiler\Config\ModificationChain' => [
                 'arguments' => [
                     'modificationsList' => [
                         'BackslashTrim' =>
                             ['instance' => 'Magento\Setup\Module\Di\Compiler\Config\Chain\BackslashTrim'],
                         'PreferencesResolving' =>
                             ['instance' => 'Magento\Setup\Module\Di\Compiler\Config\Chain\PreferencesResolving'],
                         'InterceptorSubstitution' =>
                             ['instance' => 'Magento\Setup\Module\Di\Compiler\Config\Chain\InterceptorSubstitution'],
                         'InterceptionPreferencesResolving' =>
                             ['instance' => 'Magento\Setup\Module\Di\Compiler\Config\Chain\PreferencesResolving'],
                         'ArgumentsSerialization' =>
                             ['instance' => 'Magento\Setup\Module\Di\Compiler\Config\Chain\ArgumentsSerialization'],
                     ]
                 ]
             ],
             'Magento\Setup\Module\Di\Code\Generator\PluginList' => [
                 'arguments' => [
                     'cache' => [
                         'instance' => 'Magento\Framework\App\Interception\Cache\CompiledConfig'
                     ]
                 ]
             ],
             'Magento\Setup\Module\Di\Code\Reader\ClassesScanner' => [
                 'arguments' => [
                     'excludePatterns' => $this->excludedPathsList
                 ]
             ],
             'Magento\Setup\Module\Di\Compiler\Log\Writer\Console' => [
                 'arguments' => [
                     'output' => $output,
                 ]
             ],
         ]
     );
 }
Ejemplo n.º 22
0
 /**
  * Run application
  *
  * @throws \InvalidArgumentException
  * @return ResponseInterface
  */
 public function launch()
 {
     $areaCode = $this->_areaList->getCodeByFrontName($this->_request->getFrontName());
     $this->_state->setAreaCode($areaCode);
     $this->_objectManager->configure($this->_configLoader->load($areaCode));
     /** @var \Magento\Framework\App\FrontControllerInterface $frontController */
     $frontController = $this->_objectManager->get('Magento\\Framework\\App\\FrontControllerInterface');
     $result = $frontController->dispatch($this->_request);
     // TODO: Temporary solution until all controllers return ResultInterface (MAGETWO-28359)
     if ($result instanceof ResultInterface) {
         $this->registry->register('use_page_cache_plugin', true, true);
         $result->renderResult($this->_response);
     } elseif ($result instanceof HttpInterface) {
         $this->_response = $result;
     } else {
         throw new \InvalidArgumentException('Invalid return type');
     }
     // This event gives possibility to launch something before sending output (allow cookie setting)
     $eventParams = ['request' => $this->_request, 'response' => $this->_response];
     $this->_eventManager->dispatch('controller_front_send_response_before', $eventParams);
     return $this->_response;
 }
Ejemplo n.º 23
0
 /**
  * Launch application
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function launch()
 {
     $this->state->setAreaCode($this->params->getArea());
     $this->objectManager->configure($this->configLoader->load($this->params->getArea()));
     $sourceFileGenerator = $this->sourceFileGeneratorPool->create($this->params->getExt());
     foreach ($this->params->getFiles() as $file) {
         $file .= '.' . $this->params->getExt();
         $this->logger->logMessage("Gathering {$file} sources.");
         $asset = $this->assetRepo->createAsset($file, ['area' => $this->params->getArea(), 'theme' => $this->params->getTheme(), 'locale' => $this->params->getLocale()]);
         $sourceFile = $this->assetSource->findSource($asset);
         $content = \file_get_contents($sourceFile);
         $chain = $this->chainFactory->create(['asset' => $asset, 'origContent' => $content, 'origContentType' => $asset->getContentType()]);
         $processedCoreFile = $sourceFileGenerator->generateFileTree($chain);
         $targetDir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
         $rootDir = $this->filesystem->getDirectoryWrite(DirectoryList::ROOT);
         $source = $rootDir->getRelativePath($processedCoreFile);
         $destination = $asset->getPath();
         $rootDir->copyFile($source, $destination, $targetDir);
         $this->logger->logMessage("Done");
     }
     $this->response->setCode(Response::SUCCESS);
     return $this->response;
 }
Ejemplo n.º 24
0
 /**
  * Replace name of url model
  *
  * @param string $className
  * @return $this
  */
 public function replaceClassName($className)
 {
     $this->_objectManager->configure(['preferences' => [self::CLASS_NAME => $className]]);
     return $this;
 }
Ejemplo n.º 25
0
 /**
  * @param string $areaCode
  * @return void
  */
 public function emulateLayoutArea($areaCode)
 {
     $configuration = ['Magento\\Framework\\View\\Layout' => ['arguments' => ['area' => $areaCode]]];
     $this->_objectManager->configure($configuration);
 }
Ejemplo n.º 26
0
 /**
  * Load area configuration
  *
  * @return $this
  */
 protected function _initConfig()
 {
     $this->_objectManager->configure($this->_diConfigLoader->load($this->_code));
     return $this;
 }