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


PHP Config\Value类代码示例

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


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


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