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


PHP ClassUtils::getRealClass方法代码示例

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


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

示例1: getQueryContactInformationFields

 /**
  * @param AbstractQueryDesigner $abstractQueryDesigner
  * @param object $entity
  * @param string $type
  *
  * @return string[]
  */
 public function getQueryContactInformationFields(AbstractQueryDesigner $abstractQueryDesigner, $entity, $type)
 {
     $contactInformationFields = $this->contactInformationFieldHelper->getEntityContactInformationColumns(ClassUtils::getRealClass($entity));
     if (empty($contactInformationFields)) {
         return [];
     }
     $definitionColumns = [];
     $definition = $abstractQueryDesigner->getDefinition();
     if ($definition) {
         $definition = json_decode($definition, JSON_OBJECT_AS_ARRAY);
         if (!empty($definition['columns'])) {
             $definitionColumns = array_map(function (array $columnDefinition) {
                 return $columnDefinition['name'];
             }, $definition['columns']);
         }
     }
     $typedFields = array_keys(array_filter($contactInformationFields, function ($contactInformationField) use($type) {
         return $contactInformationField === $type;
     }));
     if (!empty($definitionColumns)) {
         $typedFields = array_intersect($typedFields, $definitionColumns);
     }
     $propertyAccessor = PropertyAccess::createPropertyAccessor();
     return array_map(function ($typedField) use($propertyAccessor, $entity) {
         return (string) $propertyAccessor->getValue($entity, $typedField);
     }, $typedFields);
 }
开发者ID:dairdr,项目名称:crm,代码行数:34,代码来源:ContactInformationFieldsProvider.php

示例2: merge

 /**
  * {@inheritdoc}
  */
 public function merge(FieldData $fieldData)
 {
     $entityData = $fieldData->getEntityData();
     $masterEntity = $entityData->getMasterEntity();
     $sourceEntity = $fieldData->getSourceEntity();
     if ($masterEntity->getId() !== $sourceEntity->getId()) {
         $queryBuilder = $this->doctrineHelper->getEntityRepository('OroNoteBundle:Note')->getBaseAssociatedNotesQB(ClassUtils::getRealClass($masterEntity), $masterEntity->getId());
         $notes = $queryBuilder->getQuery()->getResult();
         if (!empty($notes)) {
             $entityManager = $this->doctrineHelper->getEntityManager(current($notes));
             foreach ($notes as $note) {
                 $entityManager->remove($note);
             }
         }
         $queryBuilder = $this->doctrineHelper->getEntityRepository('OroNoteBundle:Note')->getBaseAssociatedNotesQB(ClassUtils::getRealClass($masterEntity), $sourceEntity->getId());
         $notes = $queryBuilder->getQuery()->getResult();
         if (!empty($notes)) {
             foreach ($notes as $note) {
                 $note->setTarget($masterEntity);
             }
         }
         $fieldMetadata = $fieldData->getMetadata();
         $activityClass = $fieldMetadata->get('type');
         $entityClass = ClassUtils::getRealClass($sourceEntity);
         $queryBuilder = $this->doctrineHelper->getEntityRepository(ActivityList::ENTITY_NAME)->getActivityListQueryBuilderByActivityClass($entityClass, $sourceEntity->getId(), $activityClass);
         $activityListItems = $queryBuilder->getQuery()->getResult();
         $activityIds = ArrayUtils::arrayColumn($activityListItems, 'id');
         $this->activityListManager->replaceActivityTargetWithPlainQuery($activityIds, $entityClass, $sourceEntity->getId(), $masterEntity->getId());
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:33,代码来源:ReplaceStrategy.php

示例3: testMerge

 public function testMerge()
 {
     $account1 = new User();
     $account2 = new User();
     $this->setId($account1, 1);
     $this->setId($account2, 2);
     $entityMetadata = new EntityMetadata(['type' => ClassUtils::getRealClass($account1)]);
     $entityData = new EntityData($entityMetadata, [$account1, $account2]);
     $entityData->setMasterEntity($account1);
     $fieldData = new FieldData($entityData, new FieldMetadata());
     $fieldData->setMode(MergeModes::NOTES_REPLACE);
     $fieldData->setSourceEntity($account2);
     $queryBuilder = $this->getMockBuilder('Doctrine\\ORM\\QueryBuilder')->disableOriginalConstructor()->setMethods(['getQuery', 'getResult'])->getMock();
     $queryBuilder->expects($this->any())->method('getQuery')->will($this->returnSelf());
     $queryBuilder->expects($this->any())->method('getResult')->will($this->returnValue([new ExtendNote()]));
     $repository = $this->getMockBuilder('Oro\\Bundle\\ActivityListBundle\\Entity\\Repository\\ActivityListRepository')->disableOriginalConstructor()->setMethods(['getBaseAssociatedNotesQB', 'getActivityListQueryBuilderByActivityClass'])->getMock();
     $repository->expects($this->any())->method('getBaseAssociatedNotesQB')->willReturn($queryBuilder);
     $activityQueryBuilder = $this->getMockBuilder('Doctrine\\ORM\\QueryBuilder')->disableOriginalConstructor()->setMethods(['getQuery', 'getResult'])->getMock();
     $activityQueryBuilder->expects($this->any())->method('getQuery')->will($this->returnSelf());
     $activityQueryBuilder->expects($this->any())->method('getResult')->will($this->returnValue([['id' => 1, 'relatedActivityId' => 11], ['id' => 3, 'relatedActivityId' => 2]]));
     $repository->expects($this->any())->method('getActivityListQueryBuilderByActivityClass')->willReturn($activityQueryBuilder);
     $entityManager = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->setMethods(['remove'])->getMock();
     $this->doctrineHelper->expects($this->any())->method('getEntityRepository')->willReturn($repository);
     $this->doctrineHelper->expects($this->any())->method('getEntityManager')->willReturn($entityManager);
     $this->activityListManager->expects($this->once())->method('replaceActivityTargetWithPlainQuery');
     $this->strategy->merge($fieldData);
 }
开发者ID:startupz,项目名称:platform-1,代码行数:27,代码来源:ReplaceStrategyTest.php

示例4: onKernelController

 public function onKernelController(FilterControllerEvent $event)
 {
     if (!$this->securityContext->getToken()) {
         return true;
     }
     $controller = $event->getController();
     list($object, $method) = $controller;
     $className = ClassUtils::getRealClass($object);
     $reflectionClass = new \ReflectionClass($className);
     $reflectionMethod = $reflectionClass->getMethod($method);
     $classAnnotations = $this->annotationReader->getClassAnnotations($reflectionClass);
     $methodsAnnotations = $this->annotationReader->getMethodAnnotations($reflectionMethod);
     $allAnnotations = array_merge($classAnnotations, $methodsAnnotations);
     $ruleAnnotations = array_filter($allAnnotations, function ($annotation) {
         return $annotation instanceof Rule;
     });
     foreach ($ruleAnnotations as $ruleAnnotation) {
         if (is_array($ruleAnnotation->rules)) {
             $rules = $ruleAnnotation->rules;
         } else {
             $rules = explode(',', $ruleAnnotation->rules);
         }
         foreach ($rules as $rule) {
             $rule = trim($rule);
             if (empty($rule)) {
                 continue;
             }
             if ($this->securityContext->isGranted($rule)) {
                 return true;
             }
         }
     }
     throw new AccessDeniedException('The current user has no permissions on this action.');
 }
开发者ID:kassner,项目名称:auth-bundle,代码行数:34,代码来源:ControllerListener.php

示例5: getClassAlias

 /**
  * Get class alias of specified entity
  *
  * @param object $object
  * @param bool   $isPlural
  *
  * @return null|string
  */
 public function getClassAlias($object, $isPlural = false)
 {
     if (!is_object($object)) {
         return null;
     }
     $className = ClassUtils::getRealClass($object);
     return $isPlural ? $this->entityAliasResolver->getPluralAlias($className) : $this->entityAliasResolver->getAlias($className);
 }
开发者ID:Maksold,项目名称:platform,代码行数:16,代码来源:EntityExtension.php

示例6: fromToken

 /**
  * Creates a user security identity from a TokenInterface
  *
  * @param TokenInterface $token
  * @return UserSecurityIdentity
  */
 public static function fromToken(TokenInterface $token)
 {
     $user = $token->getUser();
     if ($user instanceof UserInterface) {
         return self::fromAccount($user);
     }
     return new self((string) $user, is_object($user) ? ClassUtils::getRealClass($user) : ClassUtils::getRealClass($token));
 }
开发者ID:laubosslink,项目名称:lab,代码行数:14,代码来源:UserSecurityIdentity.php

示例7: getAuditEntryFieldClass

 /**
  * @param AbstractUser $user
  * @return string
  */
 public function getAuditEntryFieldClass(AbstractUser $user)
 {
     $userClass = ClassUtils::getRealClass($user);
     if (!$this->entryFieldMap->containsKey($userClass)) {
         throw new \InvalidArgumentException(sprintf('Audit entry field not found for "%s"', $userClass));
     }
     return $this->entryFieldMap->get($userClass);
 }
开发者ID:anyt,项目名称:platform,代码行数:12,代码来源:AuditEntityMapper.php

示例8: getClassName

 /**
  * Get FQCN of specified entity
  *
  * @param object $object
  * @param bool   $escape Set TRUE to escape the class name for insertion into a route,
  *                       replacing \ with _ characters
  *
  * @return string
  */
 public function getClassName($object, $escape = false)
 {
     if (!is_object($object)) {
         return null;
     }
     $className = ClassUtils::getRealClass($object);
     return $escape ? $this->entityRoutingHelper->getUrlSafeClassName($className) : $className;
 }
开发者ID:northdakota,项目名称:platform,代码行数:17,代码来源:EntityExtension.php

示例9: postPersist

 /**
  * @param LifecycleEventArgs $args
  */
 public function postPersist(LifecycleEventArgs $args)
 {
     $object = $args->getEntity();
     if ($object instanceof AclAwareInterface) {
         $rules = $this->aclRulesManager->getEntityRule(ClassUtils::getRealClass($object));
         $this->aclManager->setAcl($object, $rules);
     }
 }
开发者ID:admarin1985,项目名称:tickets,代码行数:11,代码来源:AclSubscriber.php

示例10: checkEntities

 /**
  * @param array $entities
  * @return bool
  */
 protected function checkEntities(array $entities)
 {
     foreach ($entities as $entity) {
         if (in_array(ClassUtils::getRealClass($entity), $this->securityClasses, true)) {
             return true;
         }
     }
     return false;
 }
开发者ID:ramunasd,项目名称:platform,代码行数:13,代码来源:OwnerTreeListener.php

示例11: getOwnerType

 /**
  * @param object $entity
  * @return string
  */
 public function getOwnerType($entity)
 {
     $ownerClassName = ClassUtils::getRealClass($entity);
     if (!$this->configProvider->hasConfig($ownerClassName)) {
         return null;
     }
     $config = $this->configProvider->getConfig($ownerClassName);
     return $config->get('owner_type');
 }
开发者ID:snorchel,项目名称:platform,代码行数:13,代码来源:OwnerTypeExtension.php

示例12: createAction

 /**
  * @Route("/create/{entityClass}/{entityId}", name="oro_note_create")
  *
  * @Template("OroNoteBundle:Note:update.html.twig")
  * @AclAncestor("oro_note_create")
  */
 public function createAction($entityClass, $entityId)
 {
     $entityRoutingHelper = $this->getEntityRoutingHelper();
     $entity = $entityRoutingHelper->getEntity($entityClass, $entityId);
     $entityClass = ClassUtils::getRealClass($entity);
     $noteEntity = new Note();
     $noteEntity->setTarget($entity);
     $formAction = $entityRoutingHelper->generateUrlByRequest('oro_note_create', $this->getRequest(), $entityRoutingHelper->getRouteParameters($entityClass, $entityId));
     return $this->update($noteEntity, $formAction);
 }
开发者ID:Maksold,项目名称:platform,代码行数:16,代码来源:NoteController.php

示例13: postPersist

 /**
  * @param LifecycleEventArgs $args
  */
 public function postPersist(LifecycleEventArgs $args)
 {
     $entity = $args->getEntity();
     $className = ClassUtils::getRealClass($entity);
     $classRules = $this->aclRulesManager->getEntityRule($className);
     if ($classRules !== false) {
         $this->aclRulesManager->clearCreateEntityPermissions($classRules);
         $this->aclManager->setAcl($entity, $classRules);
     }
 }
开发者ID:admarin1985,项目名称:tickets,代码行数:13,代码来源:AccessControlListListener.php

示例14: getSecurityIdentities

 /**
  * Retrieves the available security identities for the given token.
  *
  * @param \Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token
  *
  * @return array An array of SecurityIdentityInterface implementations
  */
 public function getSecurityIdentities(TokenInterface $token)
 {
     $sids = parent::getSecurityIdentities($token);
     if ($token->getUser() instanceof \BackBee\CoreDomain\Security\User) {
         foreach ($token->getUser()->getGroups() as $group) {
             $securityIdentity = new UserSecurityIdentity($group->getObjectIdentifier(), ClassUtils::getRealClass($group));
             array_unshift($sids, $securityIdentity);
         }
     }
     return $sids;
 }
开发者ID:ReissClothing,项目名称:BackBee,代码行数:18,代码来源:SecurityIdentityRetrievalStrategy.php

示例15: getAuditEntryFieldClass

 /**
  * @param DiamanteUser|null $user
  *
  * @return string
  */
 public function getAuditEntryFieldClass(DiamanteUser $user = null)
 {
     if ($user === null) {
         return $this->entryFieldMap->first();
     }
     $userClass = ClassUtils::getRealClass($user);
     if (!$this->entryFieldMap->containsKey($userClass)) {
         throw new \InvalidArgumentException(sprintf('Audit entry field not found for "%s"', $userClass));
     }
     return $this->entryFieldMap->get($userClass);
 }
开发者ID:gitter-badger,项目名称:diamantedesk-application,代码行数:16,代码来源:AuditEntityMapper.php


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