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


PHP ConfigProvider::getConfigManager方法代码示例

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


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

示例1: getEntityChoiceList

 protected function getEntityChoiceList($entityClassName, $relationType)
 {
     $configManager = $this->configProvider->getConfigManager();
     $choices = array();
     if ($this->targetEntity) {
         $entityIds = array($this->configProvider->getId($this->targetEntity));
     } else {
         $entityIds = $configManager->getIds('extend');
     }
     if (in_array($relationType, array('oneToMany', 'manyToMany'))) {
         $entityIds = array_filter($entityIds, function (EntityConfigId $configId) use($configManager) {
             $config = $configManager->getConfig($configId);
             return $config->is('is_extend');
         });
     }
     $entityIds = array_filter($entityIds, function (EntityConfigId $configId) use($configManager) {
         $config = $configManager->getConfig($configId);
         return $config->is('is_extend', false) || !$config->is('state', ExtendScope::STATE_NEW);
     });
     foreach ($entityIds as $entityId) {
         $className = $entityId->getClassName();
         if ($className != $entityClassName) {
             list($moduleName, $entityName) = ConfigHelper::getModuleAndEntityNames($className);
             $choices[$className] = $moduleName . ':' . $entityName;
         }
     }
     return $choices;
 }
开发者ID:xamin123,项目名称:platform,代码行数:28,代码来源:TargetType.php

示例2: createEntity

 /**
  * @param string $entityName
  * @param bool   $isExtend
  * @param string $owner
  * @param string $mode
  */
 public function createEntity($entityName, $isExtend = true, $owner = self::OWNER_CUSTOM, $mode = ConfigModelManager::MODE_DEFAULT)
 {
     $configManager = $this->configProvider->getConfigManager();
     $configManager->createConfigEntityModel($entityName, $mode);
     $extendConfig = $this->configProvider->getConfig($entityName);
     $extendConfig->set('owner', $owner);
     $extendConfig->set('state', self::STATE_NEW);
     $extendConfig->set('is_extend', $isExtend);
     $configManager->persist($extendConfig);
     $entityFieldConfig = $configManager->getProvider('entity')->getConfig($entityName, 'id');
     $entityFieldConfig->set('label', 'Id');
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:18,代码来源:ExtendManager.php

示例3: testConfig

 public function testConfig()
 {
     $this->assertEquals($this->configManager, $this->configProvider->getConfigManager());
     $this->assertEquals(true, $this->configProvider->hasConfig(DemoEntity::ENTITY_NAME));
     $this->assertEquals($this->entityConfig, $this->configProvider->getConfig(DemoEntity::ENTITY_NAME));
     $this->assertEquals('testScope', $this->configProvider->getScope());
     $entityConfigId = new EntityConfigId('testScope', DemoEntity::ENTITY_NAME);
     $fieldConfigId = new FieldConfigId('testScope', DemoEntity::ENTITY_NAME, 'testField', 'string');
     $this->assertEquals($entityConfigId, $this->configProvider->getId(DemoEntity::ENTITY_NAME));
     $this->assertEquals($fieldConfigId, $this->configProvider->getId(DemoEntity::ENTITY_NAME, 'testField', 'string'));
     $entityConfigIdWithOtherScope = new EntityConfigId('otherScope', DemoEntity::ENTITY_NAME);
     $this->assertEquals($this->entityConfig, $this->configProvider->getConfigById($entityConfigIdWithOtherScope));
 }
开发者ID:ramunasd,项目名称:platform,代码行数:13,代码来源:ConfigProviderTest.php

示例4: getPropertyChoiceList

 /**
  * @return array
  */
 protected function getPropertyChoiceList()
 {
     $choices = array();
     if (!$this->entityClass) {
         return $choices;
     }
     $fields = $this->configProvider->filter(function (Config $config) {
         return in_array($config->getId()->getFieldType(), ['integer', 'string', 'smallint', 'decimal', 'bigint', 'text', 'money']) && $config->is('is_deleted', false);
     }, $this->entityClass);
     $entityConfigProvider = $this->configProvider->getConfigManager()->getProvider('entity');
     foreach ($fields as $field) {
         $label = $entityConfigProvider->getConfigById($field->getId())->get('label');
         $choices[$field->getId()->getFieldName()] = $label ?: $field->getId()->getFieldName();
     }
     return $choices;
 }
开发者ID:xamin123,项目名称:platform,代码行数:19,代码来源:TargetFieldType.php

示例5: getMetadata

 /**
  * {@inheritdoc}
  */
 public function getMetadata()
 {
     $metadata = parent::getMetadata();
     $entityIds = [];
     $em = $this->entityConfigProvider->getConfigManager()->getEntityManager();
     $configIds = $this->entityConfigProvider->getIds();
     foreach ($configIds as $configId) {
         $className = $configId->getClassName();
         if ($this->extendConfigProvider->getConfig($className)->in('state', [ExtendScope::STATE_ACTIVE, ExtendScope::STATE_UPDATE])) {
             $classMetadata = $em->getClassMetadata($className);
             $identifiers = $classMetadata->getIdentifier();
             $entityIds[$className] = array_shift($identifiers);
         }
     }
     $metadata['entity_ids'] = $entityIds;
     return $metadata;
 }
开发者ID:xamin123,项目名称:platform,代码行数:20,代码来源:SegmentFilter.php

示例6: getRepository

 /**
  * {@inheritdoc}
  */
 public function getRepository($className)
 {
     $repo = parent::getRepository($className);
     if ($repo instanceof EntityConfigAwareRepositoryInterface) {
         $repo->setEntityConfigManager($this->extendConfigProvider->getConfigManager());
     }
     return $repo;
 }
开发者ID:xamin123,项目名称:platform,代码行数:11,代码来源:OroEntityManager.php

示例7: getEntityChoiceList

 protected function getEntityChoiceList($entityClassName, $relationType)
 {
     $configManager = $this->configProvider->getConfigManager();
     $choices = array();
     if ($this->targetEntity) {
         $entityIds = array($this->configProvider->getId($this->targetEntity));
     } else {
         $entityIds = $configManager->getIds('extend');
     }
     if (in_array($relationType, array('oneToMany', 'manyToMany'))) {
         $entityIds = array_filter($entityIds, function (EntityConfigId $configId) use($configManager) {
             $config = $configManager->getConfig($configId);
             return $config->is('is_extend');
         });
     }
     $entityIds = array_filter($entityIds, function (EntityConfigId $configId) use($configManager) {
         $config = $configManager->getConfig($configId);
         return $config->is('is_extend', false) || !$config->is('state', ExtendManager::STATE_NEW);
     });
     foreach ($entityIds as $entityId) {
         $entityName = $moduleName = '';
         if ($entityId->getClassName() != $entityClassName) {
             $className = explode('\\', $entityId->getClassName());
             if (count($className) > 1) {
                 foreach ($className as $i => $name) {
                     if (count($className) - 1 == $i) {
                         $entityName = $name;
                     } elseif (!in_array($name, array('Bundle', 'Entity'))) {
                         $moduleName .= $name;
                     }
                 }
             }
             $choices[$entityId->getClassName()] = $moduleName . ':' . $entityName;
         }
     }
     return $choices;
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:37,代码来源:TargetType.php

示例8: clear

 /**
  * Removes the entity proxies and metadata from the cache
  *
  * @param bool $keepEntityProxies Set TRUE if proxies for custom and extend entities should not be deleted
  */
 public function clear($keepEntityProxies = false)
 {
     $filesystem = new Filesystem();
     if ($keepEntityProxies) {
         $aliasesPath = ExtendClassLoadingUtils::getAliasesPath($this->cacheDir);
         if ($filesystem->exists($aliasesPath)) {
             $filesystem->remove($aliasesPath);
         }
     } else {
         $baseCacheDir = ExtendClassLoadingUtils::getEntityBaseCacheDir($this->cacheDir);
         if ($filesystem->exists($baseCacheDir)) {
             $filesystem->remove([$baseCacheDir]);
         }
         $filesystem->mkdir(ExtendClassLoadingUtils::getEntityCacheDir($this->cacheDir));
     }
     $metadataCacheDriver = $this->configProvider->getConfigManager()->getEntityManager()->getMetadataFactory()->getCacheDriver();
     if ($metadataCacheDriver instanceof ClearableCache) {
         $metadataCacheDriver->deleteAll();
     }
 }
开发者ID:2ndkauboy,项目名称:platform,代码行数:25,代码来源:ExtendConfigDumper.php


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