本文整理汇总了PHP中Oro\Bundle\EntityConfigBundle\Config\ConfigManager::getConfigs方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::getConfigs方法的具体用法?PHP ConfigManager::getConfigs怎么用?PHP ConfigManager::getConfigs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\EntityConfigBundle\Config\ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::getConfigs方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareEntityMapEvent
/**
* Process custom entities and fields. If entity or field marked as searchable - config of this custom
* entity or field will bw added to the main search map.
*
* @param SearchMappingCollectEvent $event
*/
public function prepareEntityMapEvent(SearchMappingCollectEvent $event)
{
$mapConfig = $event->getMappingConfig();
$extendConfigs = $this->configManager->getProvider('extend')->getConfigs();
foreach ($extendConfigs as $extendConfig) {
if ($extendConfig->is('is_extend') && $extendConfig->get('state') === ExtendScope::STATE_ACTIVE) {
$className = $extendConfig->getId()->getClassName();
$searchConfigs = $this->configManager->getConfigs('search', $className);
if ($extendConfig->get('owner') === ExtendScope::OWNER_CUSTOM) {
$mapConfig = $this->addCustomEntityMapping($mapConfig, $extendConfig);
}
if (isset($mapConfig[$className]) && ($extendConfig->get('owner') === ExtendScope::OWNER_SYSTEM || $extendConfig->get('owner') === ExtendScope::OWNER_CUSTOM && $this->configManager->getProvider('search')->getConfig($className)->is('searchable'))) {
foreach ($searchConfigs as $searchConfig) {
/** @var FieldConfigId $fieldId */
$fieldId = $searchConfig->getId();
if (!$fieldId instanceof FieldConfigId) {
continue;
}
$this->processTitles($mapConfig, $searchConfig, $className, $fieldId->getFieldName());
$this->processFields($mapConfig, $searchConfig, $fieldId, $className);
}
}
}
}
$event->setMappingConfig($mapConfig);
}
示例2: preUpdate
/**
* {@inheritdoc}
*/
public function preUpdate()
{
$entityConfigs = $this->configManager->getConfigs('extend');
foreach ($entityConfigs as $entityConfig) {
if (!$entityConfig->is('is_extend')) {
continue;
}
$fieldConfigs = $this->configManager->getConfigs('extend', $entityConfig->getId()->getClassName());
foreach ($fieldConfigs as $fieldConfig) {
if (!$fieldConfig->in('state', [ExtendScope::STATE_NEW, ExtendScope::STATE_UPDATE])) {
continue;
}
// @todo: we need to find a way to use this extension to process OWNER_SYSTEM relations as well
// currently we have several problems here:
// - collision with associations
// - no support unidirectional relations
if (!$fieldConfig->is('owner', ExtendScope::OWNER_CUSTOM)) {
continue;
}
/** @var FieldConfigId $fieldConfigId */
$fieldConfigId = $fieldConfig->getId();
if (in_array($fieldConfigId->getFieldType(), RelationType::$anyToAnyRelations, true)) {
$this->createRelation($fieldConfig);
}
}
}
}
示例3: process
/**
* {@inheritdoc}
*/
public function process(ContextInterface $context)
{
/** @var CollectPublicResourcesContext $context */
$resources = $context->getResult();
$configs = $this->configManager->getConfigs('extend', null, true);
foreach ($configs as $config) {
if ($config->is('is_extend') && $config->is('owner', ExtendScope::OWNER_CUSTOM)) {
$resources->add(new PublicResource($config->getId()->getClassName()));
}
}
}
示例4: getConfigs
/**
* Gets configuration data for all configurable entities (if $className is not specified)
* or all configurable fields of the given $className.
*
* @param string|null $className
* @param bool $withHidden Set true if you need ids of all configurable entities,
* including entities marked as mode="hidden"
*
* @return array|ConfigInterface[]
*/
public function getConfigs($className = null, $withHidden = false)
{
if ($className) {
$className = $this->getClassName($className);
}
return $this->configManager->getConfigs($this->getScope(), $className, $withHidden);
}
示例5: testGetConfigs
/**
* @dataProvider getConfigsProvider
*/
public function testGetConfigs($scope, $className, $withHidden, $expectedConfigs)
{
$models = [$this->createEntityConfigModel('EntityClass1'), $this->createEntityConfigModel('EntityClass2'), $this->createEntityConfigModel('HiddenEntity', ConfigModel::MODE_HIDDEN)];
$entityModel = $this->createEntityConfigModel('EntityClass1');
$fieldModels = [$this->createFieldConfigModel($entityModel, 'f1', 'int'), $this->createFieldConfigModel($entityModel, 'f2', 'int'), $this->createFieldConfigModel($entityModel, 'hiddenField', 'int', ConfigModel::MODE_HIDDEN)];
$this->modelManager->expects($this->any())->method('checkDatabase')->willReturn(true);
$this->configCache->expects($this->any())->method('getConfigurable')->willReturn(true);
$this->modelManager->expects($this->once())->method('getModels')->with($className)->willReturn($className ? $fieldModels : $models);
if ($className) {
$this->modelManager->expects($this->any())->method('getFieldModel')->willReturnMap([[$className, 'f1', $fieldModels[0]], [$className, 'f2', $fieldModels[1]], [$className, 'hiddenField', $fieldModels[2]]]);
} else {
$this->modelManager->expects($this->any())->method('getEntityModel')->willReturnMap([['EntityClass1', $models[0]], ['EntityClass2', $models[1]], ['HiddenEntity', $models[2]]]);
}
$result = $this->configManager->getConfigs($scope, $className, $withHidden);
$this->assertEquals($expectedConfigs, array_values($result));
}
示例6: getFields
/**
* @return string[]
*/
public function getFields()
{
if (empty($this->fields)) {
$this->fields = [];
$fieldConfigs = $this->configManager->getConfigs('extend', self::CALENDAR_PROPERTY_CLASS);
foreach ($fieldConfigs as $fieldConfig) {
if (!ExtendHelper::isFieldAccessible($fieldConfig)) {
continue;
}
/** @var FieldConfigId $fieldId */
$fieldId = $fieldConfig->getId();
$fieldType = $fieldId->getFieldType();
$underlyingFieldType = $this->fieldTypeHelper->getUnderlyingType($fieldType);
if (in_array($underlyingFieldType, RelationType::$toManyRelations, true)) {
// ignore to-many relations
continue;
}
$this->fields[$fieldId->getFieldName()] = $fieldType;
}
}
return $this->fields;
}
示例7: getFields
/**
* @return string[]
*/
public function getFields()
{
if (empty($this->fields)) {
$this->fields = [];
$fieldConfigs = $this->configManager->getConfigs('extend', self::CALENDAR_PROPERTY_CLASS);
foreach ($fieldConfigs as $fieldConfig) {
if ($fieldConfig->is('state', ExtendScope::STATE_NEW) || $fieldConfig->is('is_deleted')) {
continue;
}
/** @var FieldConfigId $fieldId */
$fieldId = $fieldConfig->getId();
$fieldType = $fieldId->getFieldType();
$underlyingFieldType = $this->fieldTypeHelper->getUnderlyingType($fieldType);
if (in_array($underlyingFieldType, ['ref-many', 'manyToMany', 'oneToMany'])) {
// ignore multiple relations
continue;
}
$this->fields[$fieldId->getFieldName()] = $fieldType;
}
}
return $this->fields;
}