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


PHP ExtendHelper::isFieldAccessible方法代码示例

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


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

示例1: detailedAction

 /**
  * @param string $id
  * @param string $entityName
  * @param string $fieldName
  *
  * @return array
  *
  * @Route(
  *      "/detailed/{id}/{entityName}/{fieldName}",
  *      name="oro_entity_detailed",
  *      defaults={"id"=0, "fieldName"=""}
  * )
  * @Template
  */
 public function detailedAction($id, $entityName, $fieldName)
 {
     $entityClass = $this->get('oro_entity.routing_helper')->resolveEntityClass($entityName);
     if (!class_exists($entityClass)) {
         throw $this->createNotFoundException();
     }
     $this->checkAccess('VIEW', $entityClass);
     $entityProvider = $this->get('oro_entity_config.provider.entity');
     $extendProvider = $this->get('oro_entity_config.provider.extend');
     $relationConfig = $extendProvider->getConfig($entityClass, $fieldName);
     $relationTargetEntity = $relationConfig->get('target_entity');
     if (!class_exists($relationTargetEntity)) {
         throw $this->createNotFoundException();
     }
     /** @var ConfigInterface[] $fields */
     $fields = $extendProvider->filter(function (ConfigInterface $config) use($relationConfig) {
         /** @var FieldConfigId $fieldConfigId */
         $fieldConfigId = $config->getId();
         return ExtendHelper::isFieldAccessible($config) && in_array($fieldConfigId->getFieldName(), (array) $relationConfig->get('target_detailed'), true);
     }, $relationConfig->get('target_entity'));
     $entity = $this->getDoctrine()->getRepository($relationTargetEntity)->find($id);
     if (!$entity) {
         return $this->createNotFoundException();
     }
     $dynamicRow = array();
     foreach ($fields as $field) {
         /** @var FieldConfigId $fieldConfigId */
         $fieldConfigId = $field->getId();
         $fieldName = $fieldConfigId->getFieldName();
         $label = $entityProvider->getConfigById($fieldConfigId)->get('label') ?: $fieldName;
         $dynamicRow[$label] = FieldAccessor::getValue($entity, $fieldName);
     }
     return array('dynamic' => $dynamicRow, 'entity' => $entity);
 }
开发者ID:Maksold,项目名称:platform,代码行数:48,代码来源:EntitiesController.php

示例2: getFields

 /**
  * {@inheritdoc}
  */
 protected function getFields(DatagridConfiguration $config)
 {
     $entityClassName = $this->entityClassResolver->getEntityClass($this->getEntityName($config));
     if (!$this->configManager->hasConfig($entityClassName)) {
         return [];
     }
     $entityConfigProvider = $this->configManager->getProvider('entity');
     $extendConfigProvider = $this->configManager->getProvider('extend');
     $viewConfigProvider = $this->configManager->getProvider('view');
     $datagridConfigProvider = $this->configManager->getProvider('datagrid');
     $fields = [];
     $fieldIds = $entityConfigProvider->getIds($entityClassName);
     /** @var FieldConfigId $fieldId */
     foreach ($fieldIds as $fieldId) {
         $extendConfig = $extendConfigProvider->getConfigById($fieldId);
         if ($extendConfig->is('owner', ExtendScope::OWNER_CUSTOM) && ExtendHelper::isFieldAccessible($extendConfig) && $datagridConfigProvider->getConfigById($fieldId)->is('is_visible')) {
             $viewConfig = $viewConfigProvider->getConfig($entityClassName, $fieldId->getFieldName());
             $fields[] = ['id' => $fieldId, 'priority' => $viewConfig->get('priority', false, 0)];
         }
     }
     ArrayUtil::sortBy($fields, true);
     return array_map(function ($field) {
         return $field['id'];
     }, $fields);
 }
开发者ID:Maksold,项目名称:platform,代码行数:28,代码来源:DynamicFieldsExtension.php

示例3: isAttachmentAssociationAccessible

 /**
  * Check if an association between a given entity type and attachments is ready to be used in a business logic.
  * It means that the association should exist and should not be marked as deleted.
  *
  * @param string $entityClass The target entity class
  *
  * @return bool
  */
 protected function isAttachmentAssociationAccessible($entityClass)
 {
     $associationName = ExtendHelper::buildAssociationName($entityClass);
     if (!$this->configManager->hasConfig(self::ATTACHMENT_ENTITY, $associationName)) {
         return false;
     }
     return ExtendHelper::isFieldAccessible($this->configManager->getFieldConfig('extend', self::ATTACHMENT_ENTITY, $associationName));
 }
开发者ID:snorchel,项目名称:platform,代码行数:16,代码来源:AttachmentAssociationHelper.php

示例4: isActivityAssociationAccessible

 /**
  * Check if an association between a given entity type and activity type is ready to be used in a business logic.
  * It means that the association should exist and should not be marked as deleted.
  *
  * @param string $entityClass   The target entity class
  * @param string $activityClass The activity entity class
  *
  * @return bool
  */
 protected function isActivityAssociationAccessible($entityClass, $activityClass)
 {
     $associationName = ExtendHelper::buildAssociationName($entityClass, ActivityScope::ASSOCIATION_KIND);
     if (!$this->configManager->hasConfig($activityClass, $associationName)) {
         return false;
     }
     return ExtendHelper::isFieldAccessible($this->configManager->getFieldConfig('extend', $activityClass, $associationName));
 }
开发者ID:woei66,项目名称:platform,代码行数:17,代码来源:ActivityAssociationHelper.php

示例5: isIgnoredRelation

 /**
  * {@inheritdoc}
  */
 public function isIgnoredRelation(ClassMetadata $metadata, $associationName)
 {
     if (!$this->configManager->hasConfig($metadata->name, $associationName)) {
         return false;
     }
     $extendFieldConfig = $this->configManager->getFieldConfig('extend', $metadata->name, $associationName);
     return !ExtendHelper::isFieldAccessible($extendFieldConfig) || $this->configManager->isHiddenModel($metadata->name, $associationName) || $extendFieldConfig->has('target_entity') && !ExtendHelper::isEntityAccessible($this->configManager->getEntityConfig('extend', $extendFieldConfig->get('target_entity')));
 }
开发者ID:Maksold,项目名称:platform,代码行数:11,代码来源:ExtendExclusionProvider.php

示例6: getFields

 /**
  * {@inheritdoc}
  */
 protected function getFields(DatagridConfiguration $config)
 {
     $entityClassName = $this->entityClassResolver->getEntityClass($this->getEntityName($config));
     if (!$this->configManager->hasConfig($entityClassName)) {
         return [];
     }
     $fieldNames = $config->offsetGetByPath(self::ADDITIONAL_FIELDS_CONFIG_PATH, []);
     $fields = [];
     $extendConfigProvider = $this->configManager->getProvider('extend');
     foreach ($fieldNames as $fieldName) {
         if (!$extendConfigProvider->hasConfig($entityClassName, $fieldName)) {
             continue;
         }
         $extendConfig = $extendConfigProvider->getConfig($entityClassName, $fieldName);
         if (ExtendHelper::isFieldAccessible($extendConfig)) {
             $fields[] = $extendConfig->getId();
         }
     }
     return $fields;
 }
开发者ID:ramunasd,项目名称:platform,代码行数:23,代码来源:AdditionalFieldsExtension.php

示例7: isIgnoredRelation

 /**
  * {@inheritdoc}
  */
 public function isIgnoredRelation(ClassMetadata $metadata, $associationName)
 {
     if (!$this->configManager->hasConfig($metadata->name, $associationName)) {
         return false;
     }
     $extendFieldConfig = $this->configManager->getFieldConfig('extend', $metadata->name, $associationName);
     if (!ExtendHelper::isFieldAccessible($extendFieldConfig)) {
         return true;
     }
     if ($this->excludeHiddenFields && $this->configManager->isHiddenModel($metadata->name, $associationName)) {
         return true;
     }
     if ($extendFieldConfig->has('target_entity')) {
         $targetEntity = $extendFieldConfig->get('target_entity');
         if (!ExtendHelper::isEntityAccessible($this->configManager->getEntityConfig('extend', $targetEntity))) {
             return true;
         }
         if ($this->excludeHiddenEntities && $this->configManager->isHiddenModel($targetEntity)) {
             return true;
         }
     }
     return false;
 }
开发者ID:startupz,项目名称:platform-1,代码行数:26,代码来源:ExtendExclusionProvider.php

示例8: isApplicableField

 /**
  * {@inheritdoc}
  */
 public function isApplicableField($className, $fieldName)
 {
     if (null === $this->configManager->getConfigModelId($className, $fieldName)) {
         // this serializer works with non configurable entities as well
         return true;
     }
     if (true === $this->configManager->isHiddenModel($className, $fieldName)) {
         // exclude hidden fields
         return false;
     }
     $extendConfigProvider = $this->configManager->getProvider('extend');
     $extendConfig = $extendConfigProvider->getConfig($className, $fieldName);
     if (!$this->allowExtendedFields && $extendConfig->is('is_extend')) {
         // exclude extended fields if it is requested
         return false;
     }
     if (!ExtendHelper::isFieldAccessible($extendConfig)) {
         return false;
     }
     if ($extendConfig->has('target_entity') && !ExtendHelper::isEntityAccessible($extendConfigProvider->getConfig($extendConfig->get('target_entity')))) {
         return false;
     }
     return true;
 }
开发者ID:Maksold,项目名称:platform,代码行数:27,代码来源:ExtendEntityFieldFilter.php

示例9: 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;
 }
开发者ID:ramunasd,项目名称:platform,代码行数:25,代码来源:CalendarPropertyProvider.php

示例10: isApplicableField

 /**
  * @param ConfigInterface $extendConfig
  * @param ConfigProvider  $extendConfigProvider
  *
  * @return bool
  */
 protected function isApplicableField(ConfigInterface $extendConfig, ConfigProvider $extendConfigProvider)
 {
     return $extendConfig->is('owner', ExtendScope::OWNER_CUSTOM) && ExtendHelper::isFieldAccessible($extendConfig) && !in_array($extendConfig->getId()->getFieldType(), RelationType::$toAnyRelations, true) && (!$extendConfig->has('target_entity') || ExtendHelper::isEntityAccessible($extendConfigProvider->getConfig($extendConfig->get('target_entity'))));
 }
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:DynamicFieldsExtension.php

示例11: getExtendFieldNames

 /**
  * @param string $class
  *
  * @return array
  */
 protected function getExtendFieldNames($class)
 {
     $configProvider = $this->get('oro_entity_config.provider.extend');
     $configs = $configProvider->filter(function (ConfigInterface $extendConfig) {
         return $extendConfig->is('owner', ExtendScope::OWNER_CUSTOM) && ExtendHelper::isFieldAccessible($extendConfig) && !$extendConfig->has('target_entity') && !$extendConfig->is('is_serialized');
     }, $class);
     return array_map(function (ConfigInterface $config) {
         return $config->getId()->getFieldName();
     }, $configs);
 }
开发者ID:Maksold,项目名称:platform,代码行数:15,代码来源:CalendarEventController.php

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

示例13: isActivityAssociationEnabled

 /**
  * @param string $activityClassName
  * @param string $activityAssociationName
  *
  * @return bool
  */
 protected function isActivityAssociationEnabled($activityClassName, $activityAssociationName)
 {
     if (!$this->extendConfigProvider->hasConfig($activityClassName, $activityAssociationName)) {
         return false;
     }
     return ExtendHelper::isFieldAccessible($this->extendConfigProvider->getConfig($activityClassName, $activityAssociationName));
 }
开发者ID:woei66,项目名称:platform,代码行数:13,代码来源:ActivityManager.php

示例14: isFieldAccessible

 /**
  * Check if the given field is ready to be used in a business logic.
  *
  * @param string $className
  * @param string $fieldName
  *
  * @return bool
  */
 protected function isFieldAccessible($className, $fieldName)
 {
     return $this->extendConfigProvider->hasConfig($className, $fieldName) && ExtendHelper::isFieldAccessible($this->extendConfigProvider->getConfig($className, $fieldName));
 }
开发者ID:Maksold,项目名称:platform,代码行数:12,代码来源:EntityFieldProvider.php

示例15: getUnmappedDynamicFieldsConfigs

 /**
  * @param ClassMetadata $classMetadata
  *
  * @return ConfigInterface[]
  */
 protected function getUnmappedDynamicFieldsConfigs(ClassMetadata $classMetadata)
 {
     return array_filter($this->entityExtendProvider->getConfigs($classMetadata->name), function (ConfigInterface $config) use($classMetadata) {
         return !$classMetadata->hasField($config->getId()->getFieldName()) && !$classMetadata->hasAssociation($config->getId()->getFieldName()) && !$config->is('is_deleted') && $config->is('owner', ExtendScope::OWNER_CUSTOM) && ExtendHelper::isFieldAccessible($config) && !in_array($config->getId()->getFieldType(), RelationType::$toAnyRelations, true) && (!$config->has('target_entity') || ExtendHelper::isEntityAccessible($this->entityExtendProvider->getConfig($config->get('target_entity'))));
     });
 }
开发者ID:startupz,项目名称:platform-1,代码行数:11,代码来源:MetadataBuilder.php


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