當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。