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


PHP ConfigProvider::getConfigById方法代码示例

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


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

示例1: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $this->config = $this->configProvider->getConfigById($options['config_id']);
     $this->formFactory = $builder->getFormFactory();
     $builder->add('target_entity', new TargetType($this->configProvider, $options['config_id']), ['constraints' => [new Assert\NotBlank()]]);
     $builder->addEventListener(FormEvents::PRE_SET_DATA, array($this, 'preSubmitData'));
     $builder->addEventListener(FormEvents::PRE_SUBMIT, array($this, 'preSubmitData'));
 }
开发者ID:xamin123,项目名称:platform,代码行数:8,代码来源:RelationType.php

示例2: beforeValueRender

 /**
  * {@inheritdoc}
  */
 public function beforeValueRender(ValueRenderEvent $event)
 {
     $fieldConfig = $this->configProvider->getConfigById($event->getFieldConfigId());
     $contactInformationType = $fieldConfig->get('contact_information');
     // if some contact information type is defined -- applies proper template for its value
     if (null !== $contactInformationType && isset($this->contactInformationMap[$contactInformationType])) {
         $event->setFieldViewValue(['value' => $event->getFieldValue(), 'entity' => $event->getEntity(), 'template' => $this->contactInformationMap[$contactInformationType]]);
     }
 }
开发者ID:antrampa,项目名称:crm,代码行数:12,代码来源:ExtendFieldValueBeforeRenderListener.php

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

示例4: getValueForCollection

 /**
  * @param Collection        $collection
  * @param ConfigIdInterface $fieldConfig
  *
  * @return array
  */
 protected function getValueForCollection(Collection $collection, ConfigIdInterface $fieldConfig)
 {
     $extendConfig = $this->extendProvider->getConfigById($fieldConfig);
     $titleFieldName = $extendConfig->get('target_title');
     $value = $this->getEntityRouteOptions($extendConfig->get('target_entity'));
     $values = [];
     $priorities = [];
     /** @var object $item */
     foreach ($collection as $item) {
         $value['route_params']['id'] = $item->getId();
         $title = [];
         foreach ($titleFieldName as $fieldName) {
             $title[] = $this->propertyAccessor->getValue($item, $fieldName);
         }
         $values[] = ['id' => $item->getId(), 'link' => $value['route'] ? $this->router->generate($value['route'], $value['route_params']) : false, 'title' => implode(' ', $title)];
         if ($item instanceof PriorityItem) {
             $priorities[] = $item->getPriority();
         }
     }
     // sort values by priority if needed
     if (!empty($priorities) && count($priorities) === count($values)) {
         array_multisort($priorities, $values);
     }
     $value['values'] = $values;
     return $value;
 }
开发者ID:eltrino,项目名称:platform,代码行数:32,代码来源:ExtendFieldValueRenderListener.php

示例5: preSetData

 /**
  * @param FormEvent $event
  */
 public function preSetData(FormEvent $event)
 {
     $form = $event->getForm();
     $entityClass = $form->getConfig()->getDataClass();
     /** @var FieldConfigId[] $fieldConfigIds */
     $fieldConfigIds = $this->extendConfigProvider->getIds($entityClass);
     foreach ($fieldConfigIds as $fieldConfigId) {
         if ($fieldConfigId->getFieldType() === 'manyToOne') {
             $fieldEntityConfig = $this->entityConfigProvider->getConfigById($fieldConfigId);
             $fieldExtendConfig = $this->extendConfigProvider->getConfigById($fieldConfigId);
             if (!$fieldExtendConfig->is('state', ExtendScope::STATE_ACTIVE)) {
                 continue;
             }
             $form->add($fieldConfigId->getFieldName(), 'entity', ['required' => false, 'class' => $fieldExtendConfig->get('target_entity'), 'property' => $fieldExtendConfig->get('target_field'), 'label' => $fieldEntityConfig->get('label')]);
         }
     }
 }
开发者ID:xamin123,项目名称:platform,代码行数:20,代码来源:NoteSubscriber.php

示例6: isIgnoredEntity

 /**
  * Check if entity config is new (entity not generated yet) or was deleted
  *
  * @param EntityConfigId $entityConfigId
  *
  * @return bool
  */
 protected function isIgnoredEntity(EntityConfigId $entityConfigId)
 {
     $entityConfig = $this->extendConfigProvider->getConfigById($entityConfigId);
     if ($entityConfig->is('is_deleted') || $entityConfig->in('state', [ExtendScope::STATE_NEW, ExtendScope::STATE_DELETE])) {
         return true;
     }
     return false;
 }
开发者ID:sagikazarmark,项目名称:platform,代码行数:15,代码来源:EntityFieldProvider.php

示例7: buildManyToManyOwningSideRelation

 /**
  * @param ClassMetadataBuilder $metadataBuilder
  * @param FieldConfigId        $fieldId
  * @param string               $targetEntity
  * @param FieldConfigId|null   $targetFieldId
  * @param string[]             $cascade
  */
 protected function buildManyToManyOwningSideRelation(ClassMetadataBuilder $metadataBuilder, FieldConfigId $fieldId, $targetEntity, FieldConfigId $targetFieldId = null, array $cascade = [])
 {
     $builder = $metadataBuilder->createManyToMany($fieldId->getFieldName(), $targetEntity);
     if ($targetFieldId) {
         $builder->inversedBy($targetFieldId->getFieldName());
     }
     $builder->setJoinTable($this->nameGenerator->generateManyToManyJoinTableName($fieldId->getClassName(), $fieldId->getFieldName(), $targetEntity));
     foreach ($cascade as $cascadeType) {
         $builder->{'cascade' . ucfirst($cascadeType)}();
     }
     $builder->build();
     $extendFieldConfig = $this->extendConfigProvider->getConfigById($fieldId);
     if (!$extendFieldConfig->is('without_default')) {
         $this->buildDefaultRelation($metadataBuilder, $fieldId, $targetEntity);
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:23,代码来源:RelationMetadataBuilder.php

示例8: addEntities

 /**
  * Adds entities to $result
  *
  * @param array $result
  * @param bool  $applyExclusions
  * @param bool  $translate
  */
 protected function addEntities(array &$result, $applyExclusions, $translate)
 {
     // only configurable entities are supported
     $entityConfigs = $this->entityConfigProvider->getConfigs();
     foreach ($entityConfigs as $entityConfig) {
         $entityConfigId = $entityConfig->getId();
         $isStateCorrect = $this->extendConfigProvider->getConfigById($entityConfigId)->in('state', [ExtendScope::STATE_ACTIVE, ExtendScope::STATE_UPDATE]);
         if (false == $isStateCorrect) {
             continue;
         }
         $className = $entityConfigId->getClassName();
         if ($applyExclusions && $this->isIgnoredEntity($className)) {
             continue;
         }
         $this->addEntity($result, $className, $entityConfig->get('label'), $entityConfig->get('plural_label'), $entityConfig->get('icon'), $translate);
     }
 }
开发者ID:ramunasd,项目名称:platform,代码行数:24,代码来源:EntityProvider.php

示例9: getValueForSingleRelation

 /**
  * Return view link options or simple text
  *
  * @param object          $targetEntity
  * @param ConfigIdInterface $fieldConfigId
  *
  * @throws \Doctrine\ORM\Mapping\MappingException
  * @return array|string
  */
 protected function getValueForSingleRelation($targetEntity, ConfigIdInterface $fieldConfigId)
 {
     $fieldConfig = $this->extendProvider->getConfigById($fieldConfigId);
     $targetFieldName = $fieldConfig->get('target_field');
     $targetClassName = $fieldConfig->get('target_entity');
     if (!class_exists($targetClassName)) {
         return '';
     }
     $title = (string) $this->propertyAccessor->getValue($targetEntity, $targetFieldName);
     /** @var ClassMetadataInfo $targetMetadata */
     $targetMetadata = $this->registry->getManager()->getClassMetadata($targetClassName);
     $id = $this->propertyAccessor->getValue($targetEntity, $targetMetadata->getSingleIdentifierFieldName());
     $routeOptions = $this->getEntityRouteOptions($targetClassName, $id);
     if ($routeOptions['route'] && $this->securityFacade->isGranted('VIEW', $targetEntity)) {
         return ['link' => $this->router->generate($routeOptions['route'], $routeOptions['route_params']), 'title' => $title];
     }
     return $title;
 }
开发者ID:Maksold,项目名称:platform,代码行数:27,代码来源:ExtendFieldValueRenderListener.php

示例10: filterFields

 /**
  * @param ConfigInterface $config
  * @return bool
  */
 public function filterFields(ConfigInterface $config)
 {
     $extendConfig = $this->extendProvider->getConfigById($config->getId());
     /** @var FieldConfigId $fieldConfigId */
     $fieldConfigId = $extendConfig->getId();
     // skip system, new and deleted fields
     if (!$config->is('owner', ExtendScope::OWNER_CUSTOM) || $config->is('state', ExtendScope::STATE_NEW) || $config->is('is_deleted')) {
         return false;
     }
     // skip invisible fields
     if (!$this->viewProvider->getConfigById($config->getId())->is('is_displayable')) {
         return false;
     }
     // skip relations if they are referenced to deleted entity
     $underlyingFieldType = $this->fieldTypeHelper->getUnderlyingType($fieldConfigId->getFieldType());
     if (in_array($underlyingFieldType, RelationType::$anyToAnyRelations) && $this->extendProvider->getConfig($extendConfig->get('target_entity'))->is('is_deleted', true)) {
         return false;
     }
     return true;
 }
开发者ID:eltrino,项目名称:platform,代码行数:24,代码来源:DynamicFieldsExtension.php

示例11: filterFields

 /**
  * @param ConfigInterface $config
  * @return bool
  */
 public function filterFields(ConfigInterface $config)
 {
     $extendConfig = $this->extendProvider->getConfigById($config->getId());
     /** @var FieldConfigId $fieldConfigId */
     $fieldConfigId = $extendConfig->getId();
     // skip system and not accessible fields
     if (!$config->is('owner', ExtendScope::OWNER_CUSTOM) || !ExtendHelper::isFieldAccessible($config)) {
         return false;
     }
     // skip invisible fields
     if (!$this->viewProvider->getConfigById($config->getId())->is('is_displayable')) {
         return false;
     }
     // skip relations if they are referenced to not accessible entity
     $underlyingFieldType = $this->fieldTypeHelper->getUnderlyingType($fieldConfigId->getFieldType());
     if (in_array($underlyingFieldType, RelationType::$anyToAnyRelations, true) && !ExtendHelper::isEntityAccessible($this->extendProvider->getConfig($extendConfig->get('target_entity')))) {
         return false;
     }
     return true;
 }
开发者ID:Maksold,项目名称:platform,代码行数:24,代码来源:DynamicFieldsExtension.php

示例12: isAvailableRelation

 /**
  * Check if reverse relation can be created
  *
  * @param ConfigProvider $extendProvider
  * @param array          $relation
  * @param string         $relationKey
  *
  * @return bool
  *
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 protected function isAvailableRelation(ConfigProvider $extendProvider, array $relation, $relationKey)
 {
     /** @var FieldConfigId|false $fieldId */
     $fieldId = $relation['field_id'];
     /** @var FieldConfigId $targetFieldId */
     $targetFieldId = $relation['target_field_id'];
     if (!$relation['assign'] || !$targetFieldId) {
         if (!$targetFieldId) {
             return false;
         }
         // additional check for revers relation of manyToOne field type
         $targetEntityConfig = $extendProvider->getConfig($targetFieldId->getClassName());
         if (false === (!$relation['assign'] && !$fieldId && $targetFieldId && $targetFieldId->getFieldType() == RelationTypeBase::MANY_TO_ONE && $targetEntityConfig->get('relation') && $targetEntityConfig->get('relation')[$relationKey]['assign'])) {
             return false;
         }
     }
     if ($fieldId && $extendProvider->hasConfigById($fieldId) && $extendProvider->getConfigById($fieldId)->is('state', ExtendScope::STATE_DELETE)) {
         return false;
     }
     if ($targetFieldId && !$extendProvider->hasConfig($targetFieldId->getClassName(), $targetFieldId->getFieldName())) {
         return false;
     }
     return true;
 }
开发者ID:northdakota,项目名称:platform,代码行数:35,代码来源:FieldType.php

示例13: __construct

 public function __construct(ConfigProvider $configProvider, $configId)
 {
     $this->configProvider = $configProvider;
     $this->configId = $configId;
     $this->targetEntity = $this->configProvider->getConfigById($this->configId)->get('target_entity');
 }
开发者ID:xamin123,项目名称:platform,代码行数:6,代码来源:TargetType.php


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