當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ModuleListInterface::getOne方法代碼示例

本文整理匯總了PHP中Magento\Framework\Module\ModuleListInterface::getOne方法的典型用法代碼示例。如果您正苦於以下問題:PHP ModuleListInterface::getOne方法的具體用法?PHP ModuleListInterface::getOne怎麽用?PHP ModuleListInterface::getOne使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\Module\ModuleListInterface的用法示例。


在下文中一共展示了ModuleListInterface::getOne方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: render

 /**
  * Return info block html
  * @param  \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $m = $this->moduleList->getOne($this->getModuleName());
     $html = '<div style="padding:10px;background-color:#f8f8f8;border:1px solid #ddd;margin-bottom:7px;">
         Login As Customer Extension v' . $m['setup_version'] . ' was developed by <a href="http://magefan.com/" target="_blank">MageFan</a>.
     </div>';
     return $html;
 }
開發者ID:magefan,項目名稱:module-login-as-customer,代碼行數:13,代碼來源:Info.php

示例2: getVersion

 /**
  * Magento version
  *
  * @return string
  */
 public function getVersion()
 {
     $module = $this->moduleList->getOne('Magento_Backend');
     if (is_array($module) && isset($module['setup_version'])) {
         return $module['setup_version'];
     }
     return '2.0.0';
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:13,代碼來源:License.php

示例3: __construct

 /**
  * Constructor
  *
  * @param LoggerInterface $log
  * @param ModuleListInterface $moduleList
  * @param SetupFileResolver $fileResolver
  * @param string $moduleName
  * @param \Magento\Framework\App\Resource $resource
  * @param string $connectionName
  */
 public function __construct(LoggerInterface $log, ModuleListInterface $moduleList, SetupFileResolver $fileResolver, $moduleName, \Magento\Framework\App\Resource $resource, $connectionName = SetupInterface::DEFAULT_SETUP_CONNECTION)
 {
     parent::__construct($resource, $connectionName);
     $this->logger = $log;
     $this->fileResolver = $fileResolver;
     $this->moduleConfig = $moduleList->getOne($moduleName);
     $this->resource = new Resource($resource);
     $this->resourceName = $this->fileResolver->getResourceCode($moduleName);
 }
開發者ID:ViniciusAugusto,項目名稱:magento2,代碼行數:19,代碼來源:SetupModule.php

示例4: isModuleVersionEqual

 /**
  * Check if DB data is up to date
  *
  * @param string $moduleName
  * @param string|bool $version
  * @return bool
  * @throws \UnexpectedValueException
  */
 private function isModuleVersionEqual($moduleName, $version)
 {
     $module = $this->moduleList->getOne($moduleName);
     if (empty($module['setup_version'])) {
         throw new \UnexpectedValueException("Setup version for module '{$moduleName}' is not specified");
     }
     $configVer = $module['setup_version'];
     return $version !== false && version_compare($configVer, $version) === ModuleDataSetupInterface::VERSION_COMPARE_EQUAL;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:17,代碼來源:DbVersionInfo.php

示例5: getVersions

 /**
  * Getting the version of Magento and the version of the extension
  * @return array
  */
 protected function getVersions()
 {
     $version = array();
     $productMetadata = $this->_objectManager->get('\\Magento\\Framework\\App\\ProductMetadata');
     $version['storePlatformVersion'] = $productMetadata->getVersion();
     $version['signifydClientApp'] = 'Magento 2';
     $version['storePlatform'] = 'Magento 2';
     $version['signifydClientAppVersion'] = (string) $this->_moduleList->getOne('Signifyd_Connect')['setup_version'];
     return $version;
 }
開發者ID:signifyd,項目名稱:magento2,代碼行數:14,代碼來源:PurchaseHelper.php

示例6: getUmcModules

 /**
  * get available modules
  *
  * @return array
  */
 public function getUmcModules()
 {
     $modules = $this->helpConfig->getConfig('module', true, []);
     $installed = [];
     foreach ($modules as $module) {
         $moduleData = $this->moduleList->getOne($module['id']);
         if ($moduleData) {
             $version = $moduleData['setup_version'];
             if (isset($module['build'])) {
                 $version .= '-' . $module['build'];
             }
             $installed[] = ['module' => $module['id'], 'version' => $version];
         }
     }
     return $installed;
 }
開發者ID:artmouse,項目名稱:Umc_Base,代碼行數:21,代碼來源:Module.php

示例7: getConnectorVersion

 /**
  * Get current connector version.
  *
  * @return mixed
  */
 public function getConnectorVersion()
 {
     return $this->moduleInterface->getOne(self::MODULE_NAME)['setup_version'];
 }
開發者ID:dotmailer,項目名稱:dotmailer-magento2-extension,代碼行數:9,代碼來源:Data.php

示例8: getConfigVersion

 private function getConfigVersion()
 {
     return $this->moduleList->getOne(Module::IDENTIFIER)['setup_version'];
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:4,代碼來源:InstallSchema.php

示例9: getVersion

 /**
  * Get Module version number
  *
  * @return string
  */
 public function getVersion()
 {
     $moduleInfo = $this->_moduleList->getOne($this->getModuleName());
     return $moduleInfo['setup_version'];
 }
開發者ID:magepal,項目名稱:magento2-gmailsmtpapp,代碼行數:10,代碼來源:Version.php

示例10: getExtensionVersion

 public function getExtensionVersion()
 {
     $moduleCode = 'MagePsycho_Easypathhints';
     $moduleInfo = $this->_moduleList->getOne($moduleCode);
     return $moduleInfo['setup_version'];
 }
開發者ID:dineshmalekar,項目名稱:magento2-easy-template-path-hints,代碼行數:6,代碼來源:Data.php

示例11: handleDBSchemaData

    /**
     * Handles database schema and data (install/upgrade/backup/uninstall etc)
     *
     * @param SchemaSetupInterface | ModuleDataSetupInterface $setup
     * @param string $type
     * @return void
     * @throws \Exception
     *
     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
     * @SuppressWarnings(PHPMD.NPathComplexity)
     */
    private function handleDBSchemaData($setup, $type)
    {
        if (!(($type === 'schema') || ($type === 'data'))) {
            throw  new \Magento\Setup\Exception("Unsupported operation type $type is requested");
        }

        $this->assertDeploymentConfigExists();
        $this->assertDbAccessible();

        $resource = new \Magento\Framework\Module\ModuleResource($this->context);
        $verType = $type . '-version';
        $installType = $type . '-install';
        $upgradeType = $type . '-upgrade';
        $moduleNames = $this->moduleList->getNames();
        $moduleContextList = $this->generateListOfModuleContext($resource, $verType);
        foreach ($moduleNames as $moduleName) {
            $this->log->log("Module '{$moduleName}':");
            $configVer = $this->moduleList->getOne($moduleName)['setup_version'];
            $currentVersion = $moduleContextList[$moduleName]->getVersion();
            // Schema/Data is installed
            if ($currentVersion !== '') {
                $status = version_compare($configVer, $currentVersion);
                if ($status == \Magento\Framework\Setup\ModuleDataSetupInterface::VERSION_COMPARE_GREATER) {
                    $upgrader = $this->getSchemaDataHandler($moduleName, $upgradeType);
                    if ($upgrader) {
                        $this->log->logInline("Upgrading $type.. ");
                        $upgrader->upgrade($setup, $moduleContextList[$moduleName]);
                    }
                    if ($type === 'schema') {
                        $resource->setDbVersion($moduleName, $configVer);
                    } elseif ($type === 'data') {
                        $resource->setDataVersion($moduleName, $configVer);
                    }
                }
            } elseif ($configVer) {
                $installer = $this->getSchemaDataHandler($moduleName, $installType);
                if ($installer) {
                    $this->log->logInline("Installing $type.. ");
                    $installer->install($setup, $moduleContextList[$moduleName]);
                }
                $upgrader = $this->getSchemaDataHandler($moduleName, $upgradeType);
                if ($upgrader) {
                    $this->log->logInline("Upgrading $type.. ");
                    $upgrader->upgrade($setup, $moduleContextList[$moduleName]);
                }
                if ($type === 'schema') {
                    $resource->setDbVersion($moduleName, $configVer);
                } elseif ($type === 'data') {
                    $resource->setDataVersion($moduleName, $configVer);
                }
            }
            $this->logProgress();
        }

        if ($type === 'schema') {
            $this->log->log('Schema post-updates:');
            $handlerType = 'schema-recurring';
        } else if ($type === 'data') {
            $this->log->log('Data post-updates:');
            $handlerType = 'data-recurring';
        }
        foreach ($moduleNames as $moduleName) {
            $this->log->log("Module '{$moduleName}':");
            $modulePostUpdater = $this->getSchemaDataHandler($moduleName, $handlerType);
            if ($modulePostUpdater) {
                $this->log->logInline('Running ' + str_replace('-', ' ', $handlerType) + '...');
                $modulePostUpdater->install($setup, $moduleContextList[$moduleName]);
            }
            $this->logProgress();
        }
    }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:82,代碼來源:Installer.php

示例12: getConfigVersion

 private function getConfigVersion()
 {
     return $this->moduleList->getOne(\Ess\M2ePro\Helper\Module::IDENTIFIER)['setup_version'];
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:4,代碼來源:UpgradeData.php

示例13: getModuleVersion

 public function getModuleVersion()
 {
     return (string) $this->_moduleList->getOne("Adyen_Payment")['setup_version'];
 }
開發者ID:Adyen,項目名稱:adyen-magento2,代碼行數:4,代碼來源:Data.php


注:本文中的Magento\Framework\Module\ModuleListInterface::getOne方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。