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


PHP ConfigProvider::getId方法代码示例

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


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

示例3: 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


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