本文整理汇总了PHP中Oro\Bundle\EntityExtendBundle\Tools\ExtendHelper::isEntityAccessible方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtendHelper::isEntityAccessible方法的具体用法?PHP ExtendHelper::isEntityAccessible怎么用?PHP ExtendHelper::isEntityAccessible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\EntityExtendBundle\Tools\ExtendHelper
的用法示例。
在下文中一共展示了ExtendHelper::isEntityAccessible方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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')));
}
示例2: 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;
}
}
}
}
示例3: initializeHierarchy
/**
* {@inheritdoc}
*/
protected function initializeHierarchy()
{
$entityManagers = $this->entityManagerBag->getEntityManagers();
foreach ($entityManagers as $em) {
/** @var ClassMetadata[] $allMetadata */
$allMetadata = $em->getMetadataFactory()->getAllMetadata();
foreach ($allMetadata as $metadata) {
if ($metadata->isMappedSuperclass) {
continue;
}
if ($this->extendConfigProvider->hasConfig($metadata->name) && !ExtendHelper::isEntityAccessible($this->extendConfigProvider->getConfig($metadata->name))) {
continue;
}
$parents = $this->loadParents($metadata->name);
if (!empty($parents)) {
$this->hierarchy[$metadata->name] = $parents;
}
}
}
}
示例4: 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;
}
示例5: 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;
}
示例6: 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'))));
}
示例7: getEntityVariableGetters
/**
* @param string $entityClass
*
* @return array
*/
protected function getEntityVariableGetters($entityClass)
{
$entityClass = ClassUtils::getRealClass($entityClass);
$extendConfigProvider = $this->configManager->getProvider('extend');
if (!$extendConfigProvider->hasConfig($entityClass) || !ExtendHelper::isEntityAccessible($extendConfigProvider->getConfig($entityClass))) {
return [];
}
$result = [];
$reflClass = new \ReflectionClass($entityClass);
$fieldConfigs = $this->configManager->getProvider('email')->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;
}
示例8: 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;
}
示例9: isEntityAccessible
/**
* Check if the given entity is ready to be used in a business logic.
*
* @param string $className
*
* @return bool
*/
protected function isEntityAccessible($className)
{
return $this->extendConfigProvider->hasConfig($className) && ExtendHelper::isEntityAccessible($this->extendConfigProvider->getConfig($className));
}
示例10: 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'))));
});
}