本文整理汇总了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;
}
示例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));
}
示例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;
}