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


PHP ConfigProvider::getConfigs方法代码示例

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


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

示例1: ensureHierarchyInitialized

 /**
  * Makes sure the class hierarchy was loaded
  */
 protected function ensureHierarchyInitialized()
 {
     if (null === $this->hierarchy) {
         $this->hierarchy = [];
         $entityConfigs = $this->extendConfigProvider->getConfigs();
         foreach ($entityConfigs as $entityConfig) {
             if ($entityConfig->in('state', [ExtendScope::STATE_NEW, ExtendScope::STATE_DELETE])) {
                 continue;
             }
             if ($entityConfig->is('is_deleted')) {
                 continue;
             }
             $className = $entityConfig->getId()->getClassName();
             $parents = [];
             $this->loadParents($parents, $className);
             if (empty($parents)) {
                 continue;
             }
             // remove proxies if they are in list of parents
             $parents = array_filter($parents, function ($parentClassName) {
                 return strpos($parentClassName, ExtendHelper::ENTITY_NAMESPACE) !== 0;
             });
             if (empty($parents)) {
                 continue;
             }
             $this->hierarchy[$className] = $parents;
         }
     }
 }
开发者ID:northdakota,项目名称:platform,代码行数:32,代码来源:EntityHierarchyProvider.php

示例2: preUpdate

 /**
  * {@inheritdoc}
  */
 public function preUpdate()
 {
     $entityConfigs = $this->extendConfigProvider->getConfigs();
     foreach ($entityConfigs as $entityConfig) {
         if (!$entityConfig->is('is_extend')) {
             continue;
         }
         $fieldConfigs = $this->extendConfigProvider->getConfigs($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);
             }
         }
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:30,代码来源:RelationEntityConfigDumperExtension.php

示例3: generateEntityManagerProxies

 /**
  * Generate doctrine proxy classes for extended entities for the given entity manager
  *
  * @param EntityManager $em
  */
 protected function generateEntityManagerProxies(EntityManager $em)
 {
     $isAutoGenerated = $em->getConfiguration()->getAutoGenerateProxyClasses();
     if (!$isAutoGenerated) {
         $proxyDir = $em->getConfiguration()->getProxyDir();
         if (!empty($this->cacheDir) && $this->kernelCacheDir !== $this->cacheDir && strpos($proxyDir, $this->kernelCacheDir) === 0) {
             $proxyDir = $this->cacheDir . substr($proxyDir, strlen($this->kernelCacheDir));
         }
         $metadataFactory = $em->getMetadataFactory();
         $proxyFactory = $em->getProxyFactory();
         $extendConfigs = $this->extendConfigProvider->getConfigs(null, true);
         foreach ($extendConfigs as $extendConfig) {
             if (!$extendConfig->is('is_extend')) {
                 continue;
             }
             if ($extendConfig->in('state', [ExtendScope::STATE_NEW])) {
                 continue;
             }
             $entityClass = $extendConfig->getId()->getClassName();
             $proxyFileName = $proxyDir . DIRECTORY_SEPARATOR . '__CG__' . str_replace('\\', '', $entityClass) . '.php';
             $metadata = $metadataFactory->getMetadataFor($entityClass);
             $proxyFactory->generateProxyClasses([$metadata], $proxyDir);
             clearstatcache(true, $proxyFileName);
         }
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:31,代码来源:EntityProxyGenerator.php

示例4: addEntities

 /**
  * Adds entities to $result
  *
  * @param array $result
  */
 protected function addEntities(array &$result)
 {
     // only configurable entities are supported
     $configs = $this->entityConfigProvider->getConfigs();
     foreach ($configs as $config) {
         $this->addEntity($result, $config->getId()->getClassName(), $config->get('label'), $config->get('plural_label'), $config->get('icon'));
     }
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:13,代码来源:EntityProvider.php

示例5: findExtendFieldConfig

 /**
  * Finds a field by its name.
  * Unessential symbols, like _ or upper case letters, in a field name are ignored.
  *
  * @param string $className
  * @param string $fieldName
  *
  * @return Config|null
  */
 public function findExtendFieldConfig($className, $fieldName)
 {
     $fieldConfig = null;
     $normalizedFieldName = $this->normalizeFieldName($fieldName);
     $configs = $this->extendConfigProvider->getConfigs($className, true);
     foreach ($configs as $config) {
         if ($normalizedFieldName === $this->normalizeFieldName($config->getId()->getFieldName())) {
             $fieldConfig = $config;
             break;
         }
     }
     return $fieldConfig;
 }
开发者ID:Maksold,项目名称:platform,代码行数:22,代码来源:FieldNameValidationHelper.php

示例6: initializeHierarchy

 /**
  * {@inheritdoc}
  */
 protected function initializeHierarchy()
 {
     $entityConfigs = $this->extendConfigProvider->getConfigs();
     foreach ($entityConfigs as $entityConfig) {
         if (ExtendHelper::isEntityAccessible($entityConfig)) {
             $className = $entityConfig->getId()->getClassName();
             $parents = $this->loadParents($className);
             if (!empty($parents)) {
                 $this->hierarchy[$className] = $parents;
             }
         }
     }
 }
开发者ID:ramunasd,项目名称:platform,代码行数:16,代码来源:EntityHierarchyProvider.php

示例7: ensureDictionariesInitialized

 /**
  * Makes sure metadata for dictionary entities were loaded
  */
 protected function ensureDictionariesInitialized()
 {
     if (null === $this->dictionaries) {
         $this->dictionaries = [];
         $configs = $this->groupingConfigProvider->getConfigs();
         foreach ($configs as $config) {
             $groups = $config->get('groups');
             if (!empty($groups) && in_array(GroupingScope::GROUP_DICTIONARY, $groups)) {
                 $className = $config->getId()->getClassName();
                 $metadata = $this->getManagerForClass($className)->getClassMetadata($className);
                 $fieldNames = null;
                 if ($this->dictionaryConfigProvider->hasConfig($className)) {
                     $fieldNames = $this->dictionaryConfigProvider->getConfig($className)->get('virtual_fields');
                 }
                 if (null === $fieldNames) {
                     $fieldNames = array_filter($metadata->getFieldNames(), function ($fieldName) use(&$metadata) {
                         return !$metadata->isIdentifier($fieldName);
                     });
                 }
                 $fields = [];
                 foreach ($fieldNames as $fieldName) {
                     $fields[$fieldName] = $metadata->getTypeOfField($fieldName);
                 }
                 $this->dictionaries[$className] = $fields;
             }
         }
     }
 }
开发者ID:xamin123,项目名称:platform,代码行数:31,代码来源:DictionaryVirtualFieldProvider.php

示例8: addFields

 /**
  * Adds entity fields to $result
  *
  * @param array         $result
  * @param string        $className
  * @param bool          $applyExclusions
  * @param bool          $translate
  */
 protected function addFields(array &$result, $className, $applyExclusions, $translate)
 {
     $metadata = $this->getMetadataFor($className);
     // add regular fields
     $configs = $this->extendConfigProvider->getConfigs($className);
     foreach ($configs as $fieldConfig) {
         /** @var FieldConfigId $fieldConfigId */
         $fieldConfigId = $fieldConfig->getId();
         $fieldName = $fieldConfigId->getFieldName();
         $fieldType = $this->fieldTypeHelper->getUnderlyingType($fieldConfigId->getFieldType());
         if ($this->fieldTypeHelper->isRelation($fieldType)) {
             // skip because this field is relation
             continue;
         }
         if (isset($result[$fieldName])) {
             // skip because a field with this name is already added, it could be a virtual field
             continue;
         }
         if (!$this->entityConfigProvider->hasConfig($className, $fieldName)) {
             // skip non configurable field
             continue;
         }
         if ($this->isIgnoredField($metadata, $fieldName)) {
             continue;
         }
         if ($fieldConfig->is('is_deleted')) {
             continue;
         }
         if ($applyExclusions && $this->exclusionProvider->isIgnoredField($metadata, $fieldName)) {
             continue;
         }
         $this->addField($result, $fieldName, $fieldConfigId->getFieldType(), $this->getFieldLabel($metadata, $fieldName), $metadata->isIdentifier($fieldName), $translate);
     }
 }
开发者ID:sagikazarmark,项目名称:platform,代码行数:42,代码来源:EntityFieldProvider.php

示例9: loadMetadata

 /**
  * Loads metadata for the given security type and save them in cache
  *
  * @param $securityType
  */
 protected function loadMetadata($securityType)
 {
     $data = array();
     $securityConfigs = $this->securityConfigProvider->getConfigs();
     foreach ($securityConfigs as $securityConfig) {
         $className = $securityConfig->getId()->getClassName();
         if ($securityConfig->get('type') === $securityType && $this->extendConfigProvider->getConfig($className)->in('state', [ExtendScope::STATE_ACTIVE, ExtendScope::STATE_UPDATE])) {
             $label = '';
             if ($this->entityConfigProvider->hasConfig($className)) {
                 $label = $this->entityConfigProvider->getConfig($className)->get('label');
             }
             $permissions = $securityConfig->get('permissions');
             if (!$permissions || $permissions == 'All') {
                 $permissions = array();
             } else {
                 $permissions = explode(';', $permissions);
             }
             $data[$className] = new EntitySecurityMetadata($securityType, $className, $securityConfig->get('group_name'), $label, $permissions);
         }
     }
     if ($this->cache) {
         $this->cache->save($securityType, $data);
     }
     $this->localCache[$securityType] = $data;
 }
开发者ID:xamin123,项目名称:platform,代码行数:30,代码来源:EntitySecurityMetadataProvider.php

示例10: ensureMetadataLoaded

 /**
  * Makes sure that metadata for the given security type is loaded
  *
  * @param string $securityType The security type.
  */
 protected function ensureMetadataLoaded($securityType)
 {
     if (!isset($this->localCache[$securityType])) {
         $data = null;
         if ($this->cache) {
             $data = $this->cache->fetch($securityType);
         }
         if (!$data) {
             $securityConfigs = $this->securityConfigProvider->getConfigs();
             foreach ($securityConfigs as $securityConfig) {
                 if ($securityConfig->get('type') === $securityType) {
                     $className = $securityConfig->getId()->getClassName();
                     $label = '';
                     if ($this->entityConfigProvider->hasConfig($className)) {
                         $label = $this->entityConfigProvider->getConfig($className)->get('label');
                     }
                     $permissions = $securityConfig->get('permissions');
                     if (!$permissions || $permissions == 'All') {
                         $permissions = array();
                     } else {
                         $permissions = explode(';', $permissions);
                     }
                     $data[$className] = new EntitySecurityMetadata($securityType, $className, $securityConfig->get('group_name'), $label, $permissions);
                 }
             }
             if ($this->cache) {
                 $this->cache->save($securityType, $data);
             }
         }
         $this->localCache[$securityType] = $data;
     }
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:37,代码来源:EntitySecurityMetadataProvider.php

示例11: getEntityVariableGetters

 /**
  * @param string $entityClass
  *
  * @return array
  */
 protected function getEntityVariableGetters($entityClass)
 {
     $entityClass = ClassUtils::getRealClass($entityClass);
     if (!$this->emailConfigProvider->hasConfig($entityClass)) {
         return [];
     }
     $result = [];
     $reflClass = new \ReflectionClass($entityClass);
     $fieldConfigs = $this->emailConfigProvider->getConfigs($entityClass);
     foreach ($fieldConfigs as $fieldConfig) {
         if (!$fieldConfig->is('available_in_template')) {
             continue;
         }
         /** @var FieldConfigId $fieldId */
         $fieldId = $fieldConfig->getId();
         list($varName, $getter) = $this->getFieldAccessInfo($reflClass, $fieldId->getFieldName());
         if (!$varName) {
             continue;
         }
         $resultGetter = $getter;
         $formatters = $this->formatterManager->guessFormatters($fieldId);
         if ($formatters && count($formatters)) {
             $resultGetter = array_merge(['property_path' => $getter], $formatters);
         }
         $result[$varName] = $resultGetter;
     }
     return $result;
 }
开发者ID:northdakota,项目名称:platform,代码行数:33,代码来源:EntityVariablesProvider.php

示例12: hasAssignments

 /**
  * Checks if the given owner owns at least one entity
  *
  * @param object $owner
  * @return bool
  */
 public function hasAssignments($owner)
 {
     $result = false;
     $ownerType = $this->getOwnerType($owner);
     if ($ownerType !== OwnershipType::OWNER_TYPE_NONE) {
         foreach ($this->ownershipProvider->getConfigs(null, true) as $config) {
             if ($config->get('owner_type') === $ownerType) {
                 $entityClassName = $config->getId()->getClassName();
                 $result = $this->getAssignmentChecker($entityClassName)->hasAssignments($this->objectIdAccessor->getId($owner), $entityClassName, $this->ownershipMetadata->getMetadata($entityClassName)->getOwnerFieldName(), $this->em);
                 if ($result) {
                     break;
                 }
             }
         }
     }
     return $result;
 }
开发者ID:Maksold,项目名称:platform,代码行数:23,代码来源:OwnerDeletionManager.php

示例13: warmUpCache

 /**
  * Warms up the cache
  *
  * If the class name is specified this method warms up cache for this class only
  *
  * @param string|null $className
  */
 public function warmUpCache($className = null)
 {
     if ($className === null) {
         foreach ($this->configProvider->getConfigs() as $config) {
             $this->ensureMetadataLoaded($config->getId()->getClassName());
         }
     } else {
         $this->ensureMetadataLoaded($className);
     }
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:17,代码来源:OwnershipMetadataProvider.php

示例14: ensureHierarchyInitialized

 /**
  * Makes sure the class hierarchy was loaded
  */
 protected function ensureHierarchyInitialized()
 {
     if (null === $this->hierarchy) {
         $this->hierarchy = [];
         $entityConfigs = $this->extendConfigProvider->getConfigs();
         foreach ($entityConfigs as $entityConfig) {
             if ($entityConfig->in('state', [ExtendScope::STATE_NEW, ExtendScope::STATE_DELETE])) {
                 continue;
             }
             if ($entityConfig->is('is_deleted')) {
                 continue;
             }
             $className = $entityConfig->getId()->getClassName();
             $parents = $this->loadParents($className);
             if (!empty($parents)) {
                 $this->hierarchy[$className] = $parents;
             }
         }
     }
 }
开发者ID:sagikazarmark,项目名称:platform,代码行数:23,代码来源:EntityHierarchyProvider.php

示例15: __construct

 /**
  * @param BuildTemplateFormSubscriber $subscriber
  * @param ConfigProvider              $ownershipConfigProvider
  */
 public function __construct(BuildTemplateFormSubscriber $subscriber, ConfigProvider $ownershipConfigProvider)
 {
     $this->subscriber = $subscriber;
     $this->ownershipEntities = [];
     foreach ($ownershipConfigProvider->getConfigs() as $config) {
         $ownerType = $config->get('owner_type');
         if (!empty($ownerType) && $ownerType != OwnershipType::OWNER_TYPE_NONE) {
             $this->ownershipEntities[$config->getId()->getClassName()] = true;
         }
     }
 }
开发者ID:xamin123,项目名称:platform,代码行数:15,代码来源:EmailNotificationType.php


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