• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Config\Value类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Framework\App\Config\Value的典型用法代码示例。如果您正苦于以下问题:PHP Value类的具体用法?PHP Value怎么用?PHP Value使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: afterAfterSave

 /**
  * Invalidate WebApi cache if needed.
  * 
  * @param \Magento\Framework\App\Config\Value $subject
  * @param \Magento\Framework\App\Config\Value $result
  * @return \Magento\Framework\App\Config\Value
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function afterAfterSave(\Magento\Framework\App\Config\Value $subject, \Magento\Framework\App\Config\Value $result)
 {
     if ($subject->getPath() == \Magento\WebapiSecurity\Model\Plugin\AnonymousResourceSecurity::XML_ALLOW_INSECURE && $subject->isValueChanged()) {
         $this->cacheTypeList->invalidate(\Magento\Framework\App\Cache\Type\Webapi::TYPE_IDENTIFIER);
     }
     return $result;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:CacheInvalidator.php


示例2: afterSave

 /**
  * After save handler
  *
  * @param \Magento\Framework\App\Config\Value $subject
  * @param mixed $result
  *
  * @return mixed
  */
 public function afterSave(\Magento\Framework\App\Config\Value $subject, $result)
 {
     if ($subject->isValueChanged()) {
         $this->_eavIndexerProcessor->markIndexerAsInvalid();
     }
     return $result;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:ShowOutOfStockConfig.php


示例3: testProcess

 public function testProcess()
 {
     $path = 'design/head/logo';
     $value = 'path/to/logo';
     $this->backendModelFactory->expects($this->once())->method('createByPath')->with($path, ['value' => $value])->willReturn($this->backendModel);
     $this->backendModel->expects($this->once())->method('afterLoad');
     $this->backendModel->expects($this->once())->method('getValue')->willReturn($value);
     $this->assertEquals($value, $this->valueProcessor->process($value, $path));
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:9,代码来源:ValueProcessorTest.php


示例4: testProcess

 public function testProcess()
 {
     $path = 'design/head/logo';
     $value = 'path/to/logo';
     $scope = 'websites';
     $scopeId = 1;
     $this->backendModelFactory->expects($this->once())->method('createByPath')->with($path, ['value' => $value, 'field_config' => ['path' => $path], 'scope' => $scope, 'scope_id' => $scopeId])->willReturn($this->backendModel);
     $this->backendModel->expects($this->once())->method('afterLoad');
     $this->backendModel->expects($this->once())->method('getValue')->willReturn($value);
     $this->assertEquals($value, $this->valueProcessor->process($value, $scope, $scopeId, ['path' => $path]));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:11,代码来源:ValueProcessorTest.php


示例5: testCreate

 public function testCreate()
 {
     $scope = 'website';
     $scopeId = 1;
     $data = ['scope' => $scope, 'scopeId' => $scopeId, 'value' => 'value', 'config' => ['path' => 'design/head/default_title', 'backend_model' => 'Magento\\Framework\\App\\Config\\Value']];
     $this->metadataProviderMock->expects($this->once())->method('get')->willReturn(['head_default_title' => ['path' => 'design/head/default_title']]);
     $this->collectionFactoryMock->expects($this->once())->method('create')->willReturn($this->collection);
     $this->collection->expects($this->once())->method('addPathsFilter')->with(['head_default_title' => 'design/head/default_title']);
     $this->collection->expects($this->once())->method('addFieldToFilter')->with('scope', $scope);
     $this->collection->expects($this->once())->method('addScopeIdFilter')->with($scopeId);
     $this->collection->expects($this->once())->method('getData')->willReturn([['config_id' => 1, 'path' => 'design/head/default_title']]);
     $this->objectManagerMock->expects($this->once())->method('create')->with('Magento\\Framework\\App\\Config\\Value', ['data' => ['path' => 'design/head/default_title', 'scope' => $scope, 'scope_id' => $scopeId, 'field_config' => $data['config'], 'config_id' => 1]])->willReturn($this->backendModel);
     $this->backendModel->expects($this->once())->method('setValue')->willReturn('value');
     $this->assertSame($this->backendModel, $this->model->create($data));
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:15,代码来源:BackendModelFactoryTest.php


示例6: afterSave

 /**
  * Clean compiled JS/CSS when updating configuration settings
  *
  * @return $this
  */
 public function afterSave()
 {
     if ($this->isValueChanged()) {
         $this->_mergeService->cleanMergedJsCss();
     }
     return parent::afterSave();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:Secure.php


示例7: testAfterSave

 /**
  * @param int $callNumber
  * @param string $oldValue
  * @dataProvider afterSaveDataProvider
  */
 public function testAfterSave($callNumber, $oldValue)
 {
     $this->cacheTypeListMock->expects($this->exactly($callNumber))->method('invalidate');
     $this->configMock->expects($this->any())->method('getValue')->willReturn($oldValue);
     $this->model->setValue('some_value');
     $this->assertInstanceOf(get_class($this->model), $this->model->afterSave());
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:ValueTest.php


示例8: afterSave

 /**
  * @return $this
  */
 public function afterSave()
 {
     if ($this->isValueChanged()) {
         $this->updateSuffixForUrlRewrites();
     }
     return parent::afterSave();
 }
开发者ID:nja78,项目名称:magento2,代码行数:10,代码来源:Suffix.php


示例9: beforeSave

 /**
  * Validate minimum product qty value
  *
  * @return $this
  */
 public function beforeSave()
 {
     parent::beforeSave();
     $minQty = (int) $this->getValue() >= 0 ? (int) $this->getValue() : (int) $this->getOldValue();
     $this->setValue((string) $minQty);
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:Minqty.php


示例10: afterSave

 /**
  * Check and process robots file
  *
  * @return $this
  */
 public function afterSave()
 {
     if ($this->getValue()) {
         $this->_directory->writeFile($this->_file, $this->getValue());
     }
     return parent::afterSave();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:12,代码来源:Robots.php


示例11: afterSave

 /**
  * Invalidate cache type, when value was changed
  *
  * @return $this
  */
 public function afterSave()
 {
     if ($this->isValueChanged()) {
         $this->cacheTypeList->invalidate(\Magento\Framework\View\Element\AbstractBlock::CACHE_GROUP);
     }
     return parent::afterSave();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:Links.php


示例12: afterSave

 /**
  * Cron settings after save
  *
  * @return $this
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function afterSave()
 {
     $enabled = $this->getData('groups/log/fields/enabled/value');
     $time = $this->getData('groups/log/fields/time/value');
     $frequency = $this->getData('groups/log/fields/frequency/value');
     $frequencyWeekly = \Magento\Cron\Model\Config\Source\Frequency::CRON_WEEKLY;
     $frequencyMonthly = \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY;
     if ($enabled) {
         $cronExprArray = [intval($time[1]), intval($time[0]), $frequency == $frequencyMonthly ? '1' : '*', '*', $frequency == $frequencyWeekly ? '1' : '*'];
         $cronExprString = join(' ', $cronExprArray);
     } else {
         $cronExprString = '';
     }
     try {
         /** @var $configValue \Magento\Framework\App\Config\ValueInterface */
         $configValue = $this->_configValueFactory->create();
         $configValue->load(self::CRON_STRING_PATH, 'path');
         $configValue->setValue($cronExprString)->setPath(self::CRON_STRING_PATH)->save();
         /** @var $configValue \Magento\Framework\App\Config\ValueInterface */
         $configValue = $this->_configValueFactory->create();
         $configValue->load(self::CRON_MODEL_PATH, 'path');
         $configValue->setValue($this->_runModelPath)->setPath(self::CRON_MODEL_PATH)->save();
     } catch (\Exception $e) {
         throw new \Magento\Framework\Exception\LocalizedException(__('We can\'t save the Cron expression.'));
     }
     return parent::afterSave();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:33,代码来源:Cron.php


示例13: beforeSave

 /**
  * @return $this
  */
 public function beforeSave()
 {
     if (is_array($this->getValue())) {
         $this->setValue(serialize($this->getValue()));
     }
     return parent::beforeSave();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:10,代码来源:Serialized.php


示例14: _beforeSave

 /**
  * Validate minimum product qty value
  *
  * @return $this
  */
 protected function _beforeSave()
 {
     parent::_beforeSave();
     $minQty = (int) $this->getValue() >= 0 ? (int) $this->getValue() : (int) $this->getOldValue();
     $this->setValue((string) $minQty);
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:Minqty.php


示例15: afterSave

 /**
  * Save EAV default value after save
  *
  * @return $this
  */
 public function afterSave()
 {
     $result = parent::afterSave();
     $attributeObject = $this->eavConfig->getAttribute('customer', 'disable_auto_group_change');
     $attributeObject->setData('default_value', $this->getValue());
     $attributeObject->save();
     return $result;
 }
开发者ID:nja78,项目名称:magento2,代码行数:13,代码来源:DisableAutoGroupAssignDefault.php


示例16: beforeSave

 /**
  * @return $this
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function beforeSave()
 {
     if (!empty($this->getValue()) && !$this->_isRegexp($this->getValue())) {
         $this->messageManager->addNotice(__('Invalid regular expression: %value', ['value' => $this->getValue()]));
         $this->setValue(null);
     }
     return parent::beforeSave();
 }
开发者ID:ytorbyk,项目名称:magento2-geo-store-switcher,代码行数:12,代码来源:Regexp.php


示例17: beforeSave

 /**
  * Validate specified value against frontend area
  *
  * @return $this
  */
 public function beforeSave()
 {
     if ('' != $this->getValue()) {
         $design = clone $this->_design;
         $design->setDesignTheme($this->getValue(), \Magento\Framework\App\Area::AREA_FRONTEND);
     }
     return parent::beforeSave();
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:13,代码来源:Theme.php


示例18: afterSave

 /**
  * After save call
  * Invalidate catalog search index if engine was changed
  *
  * @return $this
  */
 public function afterSave()
 {
     parent::afterSave();
     if ($this->isValueChanged()) {
         $this->indexerRegistry->get(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)->invalidate();
     }
     return $this;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:14,代码来源:Engine.php


示例19: afterSave

 /**
  * Set status 'invalidate' for blocks and other output caches
  *
  * @return $this
  */
 public function afterSave()
 {
     $types = array_keys($this->_config->getValue(self::XML_PATH_INVALID_CACHES, \Magento\Store\Model\ScopeInterface::SCOPE_STORE));
     if ($this->isValueChanged()) {
         $this->cacheTypeList->invalidate($types);
     }
     return parent::afterSave();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:13,代码来源:Translate.php


示例20: afterSave

 /**
  * Prepare and store cron settings after save
  *
  * @return $this
  */
 public function afterSave()
 {
     if ($this->isValueChanged()) {
         $this->_resetNotificationFlag(\Magento\Tax\Model\Config::XML_PATH_TAX_NOTIFICATION_IGNORE_DISCOUNT);
         $this->_resetNotificationFlag(\Magento\Tax\Model\Config::XML_PATH_TAX_NOTIFICATION_IGNORE_PRICE_DISPLAY);
     }
     return parent::afterSave();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:13,代码来源:Notification.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Filesystem\DirectoryList类代码示例发布时间:2022-05-23
下一篇:
PHP Config\ScopeConfigInterface类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap