本文整理汇总了PHP中Oro\Bundle\EntityConfigBundle\Config\ConfigManager::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::getId方法的具体用法?PHP ConfigManager::getId怎么用?PHP ConfigManager::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\EntityConfigBundle\Config\ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::getId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processFields
/**
* Process field
*
* @param array $mapConfig
* @param ConfigInterface $searchConfig
* @param FieldConfigId $fieldId
* @param string $className
*/
protected function processFields(&$mapConfig, ConfigInterface $searchConfig, FieldConfigId $fieldId, $className)
{
$extendConfigProvider = $this->configManager->getProvider('extend');
$fieldName = $fieldId->getFieldName();
if ($searchConfig->is('searchable')) {
$fieldType = $this->transformCustomType($fieldId->getFieldType());
if (in_array($fieldType, [Indexer::RELATION_ONE_TO_ONE, Indexer::RELATION_MANY_TO_ONE])) {
$config = $extendConfigProvider->getConfig($className, $fieldName);
$targetEntity = $config->get('target_entity');
$targetField = $config->get('target_field');
$targetType = $this->transformCustomType($this->configManager->getId('extend', $targetEntity, $targetField)->getFieldType());
$field = ['name' => $fieldName, 'relation_type' => $fieldType, 'relation_fields' => [['name' => $targetField, 'target_type' => $targetType, 'target_fields' => [strtolower($fieldName . '_' . $targetField)]]]];
} elseif (in_array($fieldType, [Indexer::RELATION_MANY_TO_MANY, Indexer::RELATION_ONE_TO_MANY])) {
$config = $extendConfigProvider->getConfig($className, $fieldName);
$targetEntity = $config->get('target_entity');
$targetFields = array_unique(array_merge($config->get('target_grid'), $config->get('target_title'), $config->get('target_detailed')));
$fields = [];
foreach ($targetFields as $targetField) {
$targetType = $this->transformCustomType($this->configManager->getId('extend', $targetEntity, $targetField)->getFieldType());
$fields[] = ['name' => $targetField, 'target_type' => $targetType, 'target_fields' => [strtolower($fieldName . '_' . $targetField)]];
}
$field = ['name' => $fieldName, 'relation_type' => $fieldType, 'relation_fields' => $fields];
} else {
$field = ['name' => $fieldName, 'target_type' => $fieldType, 'target_fields' => [strtolower($fieldName)]];
}
$mapConfig[$className][self::FIELDS_PATH][] = $field;
}
}
示例2: getEntityChoiceList
/**
* @param string $entityClassName
* @param string $relationType
*
* @return array
*/
protected function getEntityChoiceList($entityClassName, $relationType)
{
/** @var EntityConfigId[] $entityIds */
$entityIds = $this->targetEntityClass ? [$this->configManager->getId('extend', $this->targetEntityClass)] : $this->configManager->getIds('extend');
if (in_array($relationType, [RelationTypeBase::ONE_TO_MANY, RelationTypeBase::MANY_TO_MANY], true)) {
$entityIds = array_filter($entityIds, function (EntityConfigId $configId) {
$config = $this->configManager->getConfig($configId);
return $config->is('is_extend');
});
}
$entityIds = array_filter($entityIds, function (EntityConfigId $configId) {
$config = $this->configManager->getConfig($configId);
return !$config->is('state', ExtendScope::STATE_NEW) && ($this->targetEntityClass || !$config->is('is_deleted'));
});
$choices = [];
foreach ($entityIds as $entityId) {
$className = $entityId->getClassName();
if (!$this->configManager->hasConfig($className, 'id') && !ExtendHelper::isCustomEntity($className)) {
// @todo: temporary ignore entities that don't have PK with name 'id'
// remove this in https://magecore.atlassian.net/browse/BAP-9713
continue;
}
if ($className !== $entityClassName) {
$entityConfig = $this->configManager->getProvider('entity')->getConfig($className);
$choices[$className] = $entityConfig->get('label');
}
}
return $choices;
}
示例3: isMultiEnumField
/**
* @param string $className
* @param string $fieldName
*
* @return bool
*/
protected function isMultiEnumField($className, $fieldName)
{
if ($this->configManager->hasConfig($className, $fieldName)) {
/** @var FieldConfigId $fieldId */
$fieldId = $this->configManager->getId('extend', $className, $fieldName);
if ($fieldId->getFieldType() === 'multiEnum') {
return true;
}
}
return false;
}
示例4: getId
/**
* Gets an instance of FieldConfigId or EntityConfigId depends on the given parameters.
*
* @param string|null $className
* @param string|null $fieldName
* @param string|null $fieldType
* @return ConfigIdInterface
*/
public function getId($className = null, $fieldName = null, $fieldType = null)
{
if ($className) {
$className = $this->getClassName($className);
}
if ($fieldName) {
if ($fieldType) {
return new FieldConfigId($this->getScope(), $className, $fieldName, $fieldType);
} else {
return $this->configManager->getId($this->getScope(), $className, $fieldName);
}
} else {
return new EntityConfigId($this->getScope(), $className);
}
}
示例5: isApplicableTarget
/**
* @param string $targetClassName
* @param string $activityClassName
*
* @return bool
*/
public function isApplicableTarget($targetClassName, $activityClassName)
{
if (!isset($this->providers[$activityClassName]) || !$this->configManager->hasConfig($targetClassName)) {
return false;
}
return $this->providers[$activityClassName]->isApplicableTarget($this->configManager->getId('entity', $targetClassName), $this->configManager);
}