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


PHP ConfigProvider::getIds方法代码示例

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


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

示例1: getTemplateVariables

 /**
  * Return available in template variables
  *
  * @param string $entityName
  * @return array
  */
 public function getTemplateVariables($entityName)
 {
     $userClassName = $this->getUser() ? get_class($this->getUser()) : false;
     $allowedData = array('entity' => array(), 'user' => array());
     $ids = $this->configProvider->getIds();
     foreach ($ids as $entityConfigId) {
         // export variables of asked entity and current user entity class
         $className = $entityConfigId->getClassName();
         if ($className == $entityName || $className == $userClassName) {
             $fields = $this->configProvider->filter(function (ConfigInterface $config) {
                 return $config->is('available_in_template');
             }, $className);
             $fields = array_values(array_map(function (ConfigInterface $field) {
                 return $field->getId()->getFieldName();
             }, $fields));
             switch ($className) {
                 case $entityName:
                     $allowedData['entity'] = $fields;
                     break;
                 case $userClassName:
                     $allowedData['user'] = $fields;
                     break;
             }
             if ($entityName == $userClassName) {
                 $allowedData['user'] = $allowedData['entity'];
             }
         }
     }
     return $allowedData;
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:36,代码来源:VariablesProvider.php

示例2: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $fields = [];
     $className = $options['className'];
     $fieldConfigIds = $this->entityProvider->getIds($className);
     /** @var FieldConfigId $fieldConfigId */
     foreach ($fieldConfigIds as $fieldConfigId) {
         if ($fieldConfigId->getFieldType() === RelationTypeBase::TO_MANY) {
             continue;
         }
         $fieldName = $fieldConfigId->getFieldName();
         $fields[$fieldName] = $this->entityProvider->getConfig($className, $fieldName)->get('label', false, ucfirst($fieldName));
     }
     $builder->add('keys', 'collection', array('required' => true, 'type' => new UniqueKeyType($fields), 'allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'prototype_name' => 'tag__name__', 'label' => false, 'constraints' => [new UniqueKeys()]));
 }
开发者ID:northdakota,项目名称:platform,代码行数:18,代码来源:UniqueKeyCollectionType.php

示例3: getMetadata

 /**
  * {@inheritdoc}
  */
 public function getMetadata()
 {
     $metadata = parent::getMetadata();
     $entityIds = [];
     $configIds = $this->entityConfigProvider->getIds();
     foreach ($configIds as $configId) {
         $className = $configId->getClassName();
         if ($this->extendConfigProvider->getConfig($className)->in('state', [ExtendScope::STATE_ACTIVE, ExtendScope::STATE_UPDATE])) {
             $classMetadata = $this->doctrine->getManagerForClass($className)->getClassMetadata($className);
             $identifiers = $classMetadata->getIdentifier();
             $entityIds[$className] = array_shift($identifiers);
         }
     }
     $metadata['entity_ids'] = $entityIds;
     return $metadata;
 }
开发者ID:Maksold,项目名称:platform,代码行数:19,代码来源:SegmentFilter.php

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

示例5: prepareConfiguration

 /**
  * Prepare configuration from entity config
  *
  * @return array
  */
 private function prepareConfiguration()
 {
     $configuration = array();
     foreach ($this->configProvider->getIds() as $entityConfigId) {
         $className = $entityConfigId->getClassName();
         $fields = $this->configProvider->filter(function (ConfigInterface $fieldConfig) {
             return $fieldConfig->is('available_in_template');
         }, $className);
         if (count($fields)) {
             $configuration[$className] = array();
             foreach ($fields as $fieldConfig) {
                 $configuration[$className][] = 'get' . strtolower($fieldConfig->getId()->getFieldName());
             }
         }
     }
     return $configuration;
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:22,代码来源:EmailRenderer.php

示例6: getVariableGetters

 /**
  * {@inheritdoc}
  */
 public function getVariableGetters($entityClass = null)
 {
     if ($entityClass) {
         // process the specified entity only
         return $this->getEntityVariableGetters($entityClass);
     }
     // process all entities
     $result = [];
     $entityIds = $this->entityConfigProvider->getIds();
     foreach ($entityIds as $entityId) {
         $className = $entityId->getClassName();
         $entityData = $this->getEntityVariableGetters($className);
         if (!empty($entityData)) {
             $result[$className] = $entityData;
         }
     }
     return $result;
 }
开发者ID:northdakota,项目名称:platform,代码行数:21,代码来源:EntityVariablesProvider.php

示例7: testGetConfigs

 public function testGetConfigs()
 {
     $this->configManager->expects($this->exactly(4))->method('getIds')->with('testScope', DemoEntity::ENTITY_NAME)->will($this->returnValue(array($this->entityConfig->getId())));
     $this->assertEquals(array($this->entityConfig->getId()), $this->configProvider->getIds(DemoEntity::ENTITY_NAME));
     $this->assertEquals(array($this->entityConfig), $this->configProvider->getConfigs(DemoEntity::ENTITY_NAME));
     $this->assertEquals(array(), $this->configProvider->filter(function (ConfigInterface $config) {
         return $config->getId()->getScope() == 'wrongScope';
     }, DemoEntity::ENTITY_NAME));
     $entityConfig = new Config(new EntityConfigId(DemoEntity::ENTITY_NAME, 'testScope'));
     $entityConfig->set('key', 'value');
     $this->assertEquals(array($entityConfig), $this->configProvider->map(function (ConfigInterface $config) {
         return $config->set('key', 'value');
     }, DemoEntity::ENTITY_NAME));
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:14,代码来源:ConfigProviderTest.php

示例8: getUnidirectionalRelations

 /**
  * Return mapping data for entities that has one-way link to $className entity
  *
  * @param string $className
  *
  * @return array
  */
 protected function getUnidirectionalRelations($className)
 {
     $relations = [];
     /** @var EntityConfigId[] $entityConfigIds */
     $entityConfigIds = $this->entityConfigProvider->getIds();
     foreach ($entityConfigIds as $entityConfigId) {
         if ($this->isIgnoredEntity($entityConfigId)) {
             continue;
         }
         $metadata = $this->getMetadataFor($entityConfigId->getClassName());
         $targetMappings = $metadata->getAssociationMappings();
         if (empty($targetMappings)) {
             continue;
         }
         foreach ($targetMappings as $mapping) {
             if ($mapping['isOwningSide'] && empty($mapping['inversedBy']) && $mapping['targetEntity'] === $className) {
                 $relations[$mapping['sourceEntity'] . '::' . $mapping['fieldName']] = $mapping;
             }
         }
     }
     return $relations;
 }
开发者ID:sagikazarmark,项目名称:platform,代码行数:29,代码来源:EntityFieldProvider.php

示例9: testGetIdsWithHidden

 public function testGetIdsWithHidden()
 {
     $this->configManager->expects($this->once())->method('getIds')->with('testScope', DemoEntity::ENTITY_NAME, true)->will($this->returnValue(array($this->entityConfig->getId())));
     $this->assertEquals(array($this->entityConfig->getId()), $this->configProvider->getIds(DemoEntity::ENTITY_NAME, true));
 }
开发者ID:ramunasd,项目名称:platform,代码行数:5,代码来源:ConfigProviderTest.php


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