本文整理汇总了PHP中Oro\Bundle\EntityConfigBundle\Config\ConfigManager::hasConfigEntityModel方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::hasConfigEntityModel方法的具体用法?PHP ConfigManager::hasConfigEntityModel怎么用?PHP ConfigManager::hasConfigEntityModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\EntityConfigBundle\Config\ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::hasConfigEntityModel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createEnumValueConfigEntityModel
/**
* @param string $enumValueClassName The full class name of an entity is used to store enum values
* @param string $enumCode The unique identifier of an enum
* @param bool $isMultiple Indicates whether several options can be selected for this enum
* or it supports only one selected option
* @param bool|null $isPublic Indicates whether this enum can be used by any entity or
* it is designed to use in one entity only
* NULL means unspecified. In this case this attribute will not be
* changed for existing enum entity and will be set to FALSE
* for new enum entity
*/
protected function createEnumValueConfigEntityModel($enumValueClassName, $enumCode, $isMultiple, $isPublic)
{
if ($this->configManager->hasConfigEntityModel($enumValueClassName)) {
if (null !== $isPublic) {
$this->relationBuilder->updateEntityConfigs($enumValueClassName, ['enum' => ['public' => $isPublic]]);
}
return;
}
if (null === $isPublic) {
$isPublic = false;
}
// create entity
$this->configManager->createConfigEntityModel($enumValueClassName, ConfigModelManager::MODE_HIDDEN);
$this->relationBuilder->updateEntityConfigs($enumValueClassName, ['entity' => ['label' => ExtendHelper::getEnumTranslationKey('label', $enumCode), 'plural_label' => ExtendHelper::getEnumTranslationKey('plural_label', $enumCode), 'description' => ExtendHelper::getEnumTranslationKey('description', $enumCode)], 'extend' => ['owner' => ExtendScope::OWNER_SYSTEM, 'is_extend' => true, 'table' => $this->nameGenerator->generateEnumTableName($enumCode, true), 'inherit' => ExtendHelper::BASE_ENUM_VALUE_CLASS], 'enum' => ['code' => $enumCode, 'public' => $isPublic, 'multiple' => $isMultiple]]);
// create fields
$this->configManager->createConfigFieldModel($enumValueClassName, 'id', 'string');
$this->relationBuilder->updateFieldConfigs($enumValueClassName, 'id', ['entity' => ['label' => ExtendHelper::getEnumTranslationKey('label', $enumCode, 'id'), 'description' => ExtendHelper::getEnumTranslationKey('description', $enumCode, 'id')], 'importexport' => ['identity' => true]]);
$this->configManager->createConfigFieldModel($enumValueClassName, 'name', 'string');
$this->relationBuilder->updateFieldConfigs($enumValueClassName, 'name', ['entity' => ['label' => ExtendHelper::getEnumTranslationKey('label', $enumCode, 'name'), 'description' => ExtendHelper::getEnumTranslationKey('description', $enumCode, 'name')], 'datagrid' => ['is_visible' => false]]);
$this->configManager->createConfigFieldModel($enumValueClassName, 'priority', 'integer');
$this->relationBuilder->updateFieldConfigs($enumValueClassName, 'priority', ['entity' => ['label' => ExtendHelper::getEnumTranslationKey('label', $enumCode, 'priority'), 'description' => ExtendHelper::getEnumTranslationKey('description', $enumCode, 'priority')], 'datagrid' => ['is_visible' => false]]);
$this->configManager->createConfigFieldModel($enumValueClassName, 'default', 'boolean');
$this->relationBuilder->updateFieldConfigs($enumValueClassName, 'default', ['entity' => ['label' => ExtendHelper::getEnumTranslationKey('label', $enumCode, 'default'), 'description' => ExtendHelper::getEnumTranslationKey('description', $enumCode, 'default')], 'datagrid' => ['is_visible' => false]]);
}
示例2: testHasConfigEntityModel
public function testHasConfigEntityModel()
{
$this->modelManager->expects($this->once())->method('findEntityModel')->with(self::ENTITY_CLASS)->willReturn($this->createEntityConfigModel(self::ENTITY_CLASS));
$result = $this->configManager->hasConfigEntityModel(self::ENTITY_CLASS);
$this->assertTrue($result);
}
示例3: hasConfigForInheritanceTarget
/**
* @param $value
*
* @return bool
*/
protected function hasConfigForInheritanceTarget($value)
{
$result = is_array($value) && array_key_exists('target', $value) && $this->configManager->hasConfigEntityModel($value['target']);
return $result;
}