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


PHP ConfigProvider::persist方法代码示例

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


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

示例1: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventListener(FormEvents::POST_SUBMIT, function () use($options) {
         /** @var FieldConfigId $fieldConfigId */
         $fieldConfigId = $options['config_id'];
         $entityConfig = $this->extendConfigProvider->getConfig($fieldConfigId->getClassName());
         if ($entityConfig->is('state', ExtendScope::STATE_ACTIVE) && !$this->hasRelation($entityConfig, $this->getRelationKey($fieldConfigId))) {
             $entityConfig->set('state', ExtendScope::STATE_UPDATE);
             $this->extendConfigProvider->persist($entityConfig);
             $this->extendConfigProvider->flush();
         }
     });
 }
开发者ID:hugeval,项目名称:platform,代码行数:16,代码来源:FileConfigType.php

示例2: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventListener(FormEvents::POST_SUBMIT, function () use($options) {
         /** @var FieldConfigId $configId */
         $configId = $options['config_id'];
         $relationKey = ExtendHelper::buildRelationKey($configId->getClassName(), $configId->getFieldName(), 'manyToOne', 'Oro\\Bundle\\AttachmentBundle\\Entity\\File');
         /** @var Config $entityExtendConfig */
         $entityExtendConfig = $this->extendConfigProvider->getConfig($configId->getClassName());
         if ($this->isApplicable($entityExtendConfig, $relationKey)) {
             if ($entityExtendConfig->is('state', ExtendScope::STATE_ACTIVE)) {
                 $entityExtendConfig->set('state', ExtendScope::STATE_UPDATE);
                 $this->extendConfigProvider->persist($entityExtendConfig);
                 $this->extendConfigProvider->flush();
             }
         }
     });
 }
开发者ID:xamin123,项目名称:platform,代码行数:20,代码来源:FileConfigType.php

示例3: createTargetRelation

 protected function createTargetRelation(Config $fieldConfig, $relationKey)
 {
     $selfEntityClass = $fieldConfig->getId()->getClassName();
     $targetEntityClass = $fieldConfig->get('target_entity');
     $selfConfig = $this->extendConfigProvider->getConfig($selfEntityClass);
     $selfRelations = $selfConfig->get('relation');
     $selfRelationConfig =& $selfRelations[$relationKey];
     $selfRelationConfig['field_id'] = $fieldConfig;
     $targetConfig = $this->extendConfigProvider->getConfig($targetEntityClass);
     $targetRelations = $targetConfig->get('relation');
     $targetRelationConfig =& $targetRelations[$relationKey];
     $targetRelationConfig['target_field_id'] = $fieldConfig;
     $selfConfig->set('relation', $selfRelations);
     $targetConfig->set('relation', $targetRelations);
     $this->extendConfigProvider->persist($targetConfig);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:16,代码来源:ConfigSubscriber.php

示例4: updateRelationValues

 /**
  * @param string        $targetClass
  * @param FieldConfigId $fieldId
  */
 protected function updateRelationValues($targetClass, FieldConfigId $fieldId)
 {
     $targetConfig = $this->configProvider->getConfig($targetClass);
     $relations = $targetConfig->get('relation', false, []);
     $schema = $targetConfig->get('schema', false, []);
     foreach ($relations as &$relation) {
         if ($relation['target_field_id'] == $fieldId) {
             if ($relation['owner']) {
                 $relation['assign'] = true;
             }
             /** @var FieldConfigId $relationFieldId */
             $relationFieldId = $relation['field_id'];
             if ($relationFieldId) {
                 $schema['relation'][$relationFieldId->getFieldName()] = $relationFieldId->getFieldName();
             }
         }
     }
     $targetConfig->set('relation', $relations);
     $targetConfig->set('schema', $schema);
     $this->configProvider->persist($targetConfig);
 }
开发者ID:northdakota,项目名称:platform,代码行数:25,代码来源:ExtendConfigDumper.php

示例5: updateStateValues

 /**
  * @param ConfigInterface $extendConfig
  *
  * @return bool
  */
 protected function updateStateValues(ConfigInterface $extendConfig)
 {
     $hasChanges = false;
     $className = $extendConfig->getId()->getClassName();
     $fieldConfigs = $this->configProvider->getConfigs($className, true);
     if ($extendConfig->is('state', ExtendScope::STATE_DELETE)) {
         // mark entity as deleted
         if (!$extendConfig->is('is_deleted')) {
             $extendConfig->set('is_deleted', true);
             $this->configProvider->persist($extendConfig);
             $hasChanges = true;
         }
         // mark all fields as deleted
         foreach ($fieldConfigs as $fieldConfig) {
             if (!$fieldConfig->is('is_deleted')) {
                 $fieldConfig->set('is_deleted', true);
                 $this->configProvider->persist($fieldConfig);
                 $hasChanges = true;
             }
         }
     } elseif (!$extendConfig->is('state', ExtendScope::STATE_ACTIVE)) {
         $hasNotActiveFields = false;
         foreach ($fieldConfigs as $fieldConfig) {
             if (!$fieldConfig->is('state', ExtendScope::STATE_DELETE) && !$fieldConfig->is('state', ExtendScope::STATE_ACTIVE)) {
                 $hasNotActiveFields = true;
                 break;
             }
         }
         // Set entity state to active if all fields are active or deleted
         if (!$hasNotActiveFields) {
             $extendConfig->set('state', ExtendScope::STATE_ACTIVE);
             $this->configProvider->persist($extendConfig);
         }
         $hasChanges = true;
     }
     if ($hasChanges) {
         $this->configProvider->flush();
     }
 }
开发者ID:2ndkauboy,项目名称:platform,代码行数:44,代码来源:ExtendConfigDumper.php

示例6: testPersistFlush

 public function testPersistFlush()
 {
     $this->configProvider->persist($this->entityConfig);
     $this->configProvider->flush();
 }
开发者ID:ramunasd,项目名称:platform,代码行数:5,代码来源:ConfigProviderTest.php


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