当前位置: 首页>>代码示例>>PHP>>正文


PHP ObjectManagerProvider::get方法代码示例

本文整理汇总了PHP中Magento\Setup\Model\ObjectManagerProvider::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectManagerProvider::get方法的具体用法?PHP ObjectManagerProvider::get怎么用?PHP ObjectManagerProvider::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Setup\Model\ObjectManagerProvider的用法示例。


在下文中一共展示了ObjectManagerProvider::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 /**
  * Get instance of DateTime
  *
  * @return \Magento\Framework\Stdlib\DateTime\DateTime
  */
 public function get()
 {
     if (!$this->dateTime) {
         $this->dateTime = $this->objectManagerProvider->get()->create('Magento\\Framework\\Stdlib\\DateTime\\DateTime', ['localeDate' => $this->tzProvider->get()]);
     }
     return $this->dateTime;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:DateTimeProvider.php

示例2: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$this->deploymentConfig->isAvailable()) {
         $output->writeln("<info>No information is available: the Magento application is not installed.</info>");
         return;
     }
     /** @var DbVersionInfo $dbVersionInfo */
     $dbVersionInfo = $this->objectManagerProvider->get()->get('Magento\\Framework\\Module\\DbVersionInfo');
     $outdated = $dbVersionInfo->getDbVersionErrors();
     if (!empty($outdated)) {
         $output->writeln("<info>The module code base doesn't match the DB schema and data.</info>");
         $versionParser = new VersionParser();
         $codebaseUpdateNeeded = false;
         foreach ($outdated as $row) {
             if (!$codebaseUpdateNeeded && $row[DbVersionInfo::KEY_CURRENT] !== 'none') {
                 // check if module code base update is needed
                 $currentVersion = $versionParser->parseConstraints($row[DbVersionInfo::KEY_CURRENT]);
                 $requiredVersion = $versionParser->parseConstraints('>' . $row[DbVersionInfo::KEY_REQUIRED]);
                 if ($requiredVersion->matches($currentVersion)) {
                     $codebaseUpdateNeeded = true;
                 }
             }
             $output->writeln(sprintf("<info>%20s %10s: %11s  ->  %-11s</info>", $row[DbVersionInfo::KEY_MODULE], $row[DbVersionInfo::KEY_TYPE], $row[DbVersionInfo::KEY_CURRENT], $row[DbVersionInfo::KEY_REQUIRED]));
         }
         if ($codebaseUpdateNeeded) {
             $output->writeln('<info>Some modules use code versions newer or older than the database. ' . "First update the module code, then run 'setup:upgrade'.</info>");
             // we must have an exit code higher than zero to indicate something was wrong
             return \Magento\Framework\Console\Cli::RETURN_FAILURE;
         } else {
             $output->writeln("<info>Run 'setup:upgrade' to update your DB schema and data.</info>");
         }
     } else {
         $output->writeln('<info>All modules are up to date.</info>');
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:38,代码来源:DbStatusCommand.php

示例3: get

 /**
  * Get instance of Timezone
  *
  * @return \Magento\Framework\Stdlib\DateTime\Timezone
  */
 public function get()
 {
     if (!$this->timezone) {
         $this->timezone = $this->objectManagerProvider->get()->create('Magento\\Framework\\Stdlib\\DateTime\\Timezone', ['scopeType' => ScopeConfigInterface::SCOPE_TYPE_DEFAULT]);
     }
     return $this->timezone;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:TimezoneProvider.php

示例4: testGet

 public function testGet()
 {
     $this->locator->expects($this->once())->method('get')->with(InitParamListener::BOOTSTRAP_PARAM)->willReturn([]);
     $objectManager = $this->object->get();
     $this->assertInstanceOf('Magento\\Framework\\ObjectManagerInterface', $objectManager);
     $this->assertSame($objectManager, $this->object->get());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:ObjectManagerProviderTest.php

示例5: create

 /**
  * Creates setup
  *
  * @param ResourceConnection $appResource
  * @return Setup
  */
 public function create(ResourceConnection $appResource = null)
 {
     $objectManager = $this->objectManagerProvider->get();
     if ($appResource === null) {
         $appResource = $objectManager->get('Magento\\Framework\\App\\ResourceConnection');
     }
     return new Setup($appResource);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:SetupFactory.php

示例6: __construct

 /**
  *  Constructor
  *
  * @param \Magento\Setup\Model\ObjectManagerProvider $objectManagerProvider
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @param \Magento\Setup\Model\Cron\Status $status
  * @param array $name
  * @param array $params
  */
 public function __construct(\Magento\Setup\Model\ObjectManagerProvider $objectManagerProvider, \Symfony\Component\Console\Output\OutputInterface $output, \Magento\Setup\Model\Cron\Status $status, $name, $params = [])
 {
     $this->cleanupFiles = $objectManagerProvider->get()->get('Magento\\Framework\\App\\State\\CleanupFiles');
     $this->cache = $objectManagerProvider->get()->get('Magento\\Framework\\App\\Cache');
     $this->output = $output;
     $this->status = $status;
     parent::__construct($output, $status, $objectManagerProvider, $name, $params);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:17,代码来源:JobStaticRegenerate.php

示例7: indexAction

 /**
  * @return ViewModel
  */
 public function indexAction()
 {
     if ($this->moduleList->has('Magento_SampleData')) {
         /** @var \Magento\Framework\Setup\SampleData\State $sampleData */
         $sampleData = $this->objectManagerProvider->get()->get('Magento\\Framework\\Setup\\SampleData\\State');
         $isSampleDataErrorInstallation = $sampleData->hasError();
     } else {
         $isSampleDataErrorInstallation = false;
     }
     $view = new ViewModel(['isSampleDataErrorInstallation' => $isSampleDataErrorInstallation]);
     $view->setTerminal(true);
     return $view;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:Success.php

示例8: __construct

 /**
  * Constructor
  *
  * @param ObjectManagerProvider $objectManagerProvider
  * @param \Magento\Framework\Composer\Remove $remove
  * @param UninstallCollector $collector
  * @param \Magento\Setup\Module\SetupFactory $setupFactory
  */
 public function __construct(ObjectManagerProvider $objectManagerProvider, \Magento\Framework\Composer\Remove $remove, UninstallCollector $collector, \Magento\Setup\Module\SetupFactory $setupFactory)
 {
     $this->objectManager = $objectManagerProvider->get();
     $this->remove = $remove;
     $this->collector = $collector;
     $this->setupFactory = $setupFactory;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:15,代码来源:ModuleUninstaller.php

示例9: __construct

 /**
  * Constructor
  *
  * @param MagentoComposerApplicationFactory $applicationFactory
  * @param \Magento\Framework\Filesystem $filesystem
  * @param ComposerInformation $composerInformation
  * @param ObjectManagerProvider $objectManagerProvider
  * @throws \Exception
  */
 public function __construct(MagentoComposerApplicationFactory $applicationFactory, Filesystem $filesystem, ComposerInformation $composerInformation, ObjectManagerProvider $objectManagerProvider)
 {
     $this->application = $applicationFactory->create();
     $this->directory = $filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
     $this->objectManager = $objectManagerProvider->get();
     $this->composerInformation = $composerInformation;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:UpdatePackagesCache.php

示例10: __construct

 /**
  * Constructor
  *
  * @param ObjectManagerProvider $objectManagerProvider
  * @param WebLogger $logger
  * @param DirectoryList $directoryList
  * @param Filesystem $fileSystem
  */
 public function __construct(ObjectManagerProvider $objectManagerProvider, WebLogger $logger, DirectoryList $directoryList, Filesystem $fileSystem)
 {
     $objectManager = $objectManagerProvider->get();
     $this->backupHandler = $objectManager->create('Magento\\Framework\\Setup\\BackupRollback', ['log' => $logger]);
     $this->directoryList = $directoryList;
     $this->fileSystem = $fileSystem;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:BackupActionItems.php

示例11: getPackageAvailableVersions

 /**
  * Retrieve all available versions for a package
  *
  * @param string $package
  * @return array
  * @throws \RuntimeException
  */
 private function getPackageAvailableVersions($package)
 {
     $magentoRepositories = $this->composerInformation->getRootRepositories();
     // Check we have only one repo.magento.com repository
     if (count($magentoRepositories) === 1 && strpos($magentoRepositories[0], $this->packagesAuth->getCredentialBaseUrl())) {
         $packagesJsonData = $this->getPackagesJson();
         if ($packagesJsonData) {
             $packagesJsonData = json_decode($packagesJsonData, true);
         } else {
             $packagesJsonData['packages'] = [];
         }
         if (isset($packagesJsonData['packages'][$package])) {
             $packageVersions = $packagesJsonData['packages'][$package];
             uksort($packageVersions, 'version_compare');
             $packageVersions = array_reverse($packageVersions);
             return array_keys($packageVersions);
         }
     } else {
         $versionsPattern = '/^versions\\s*\\:\\s(.+)$/m';
         $commandParams = [self::PARAM_COMMAND => self::COMPOSER_SHOW, self::PARAM_PACKAGE => $package, self::PARAM_AVAILABLE => true];
         $applicationFactory = $this->objectManagerProvider->get()->get('Magento\\Framework\\Composer\\MagentoComposerApplicationFactory');
         /** @var \Magento\Composer\MagentoComposerApplication $application */
         $application = $applicationFactory->create();
         $result = $application->runComposerCommand($commandParams);
         $matches = [];
         preg_match($versionsPattern, $result, $matches);
         if (isset($matches[1])) {
             return explode(', ', $matches[1]);
         }
     }
     throw new \RuntimeException(sprintf('Couldn\'t get available versions for package %s', $package));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:39,代码来源:PackagesData.php

示例12: indexAction

 /**
  * @return ViewModel
  */
 public function indexAction()
 {
     $sampleDataDeployed = $this->moduleList->has('Magento_SampleData');
     if ($sampleDataDeployed) {
         /** @var \Magento\Framework\Setup\SampleData\State $sampleData */
         $sampleData = $this->objectManagerProvider->get()->get('Magento\\Framework\\Setup\\SampleData\\State');
         $isSampleDataInstalled = $sampleData->isInstalled();
         $isSampleDataErrorInstallation = $sampleData->hasError();
     } else {
         $isSampleDataInstalled = false;
         $isSampleDataErrorInstallation = false;
     }
     $view = new ViewModel(['timezone' => $this->list->getTimezoneList(), 'currency' => $this->list->getCurrencyList(), 'language' => $this->list->getLocaleList(), 'isSampleDataInstalled' => $isSampleDataInstalled, 'isSampleDataErrorInstallation' => $isSampleDataErrorInstallation]);
     $view->setTerminal(true);
     return $view;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:CustomizeYourStore.php

示例13: __construct

 /**
  * Inject dependencies
  *
  * @param InstallerFactory $installerFactory
  * @param DeploymentConfig $deploymentConfig
  * @param ObjectManagerProvider $objectManagerProvider
  */
 public function __construct(InstallerFactory $installerFactory, DeploymentConfig $deploymentConfig, ObjectManagerProvider $objectManagerProvider)
 {
     $this->installerFactory = $installerFactory;
     $this->deploymentConfig = $deploymentConfig;
     $this->objectManager = $objectManagerProvider->get();
     parent::__construct();
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:14,代码来源:InstallStoreConfigurationCommand.php

示例14: __construct

 /**
  * Constructor
  *
  * @param ObjectManagerProvider $objectManagerProvider
  * @param MaintenanceMode $maintenanceMode
  * @param DeploymentConfig $deploymentConfig
  */
 public function __construct(ObjectManagerProvider $objectManagerProvider, MaintenanceMode $maintenanceMode, DeploymentConfig $deploymentConfig)
 {
     $this->objectManager = $objectManagerProvider->get();
     $this->maintenanceMode = $maintenanceMode;
     $this->backupRollbackFactory = $this->objectManager->get('Magento\\Framework\\Setup\\BackupRollbackFactory');
     $this->deploymentConfig = $deploymentConfig;
     parent::__construct();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:RollbackCommand.php

示例15: __construct

 /**
  * Constructor
  *
  * @param ModuleLoader $moduleLoader
  * @param DeploymentConfig $deploymentConfig
  * @param ObjectManagerProvider $objectManagerProvider
  */
 public function __construct(ModuleLoader $moduleLoader, DeploymentConfig $deploymentConfig, ObjectManagerProvider $objectManagerProvider)
 {
     $this->allModules = $moduleLoader->load();
     foreach (array_keys($this->allModules) as $module) {
         $this->allModules[$module]['selected'] = true;
         $this->allModules[$module]['disabled'] = true;
     }
     $this->deploymentConfig = $deploymentConfig;
     $this->dependencyChecker = $objectManagerProvider->get()->get('Magento\\Framework\\Module\\DependencyChecker');
 }
开发者ID:opexsw,项目名称:magento2,代码行数:17,代码来源:ModuleStatus.php


注:本文中的Magento\Setup\Model\ObjectManagerProvider::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。