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


PHP ClassUtils::getRealClass方法代码示例

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


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

示例1: supports

 /**
  * {@inheritdoc}
  */
 public function supports(PuliResource $resource)
 {
     if (false === $resource instanceof CmfResource) {
         return false;
     }
     return $this->metadataFactory->hasMetadataFor(ClassUtils::getRealClass($resource->getPayloadType()));
 }
开发者ID:symfony-cmf,项目名称:resource,代码行数:10,代码来源:PhpcrOdmEnhancer.php

示例2: boot

 /**
  * {@inheritDoc}
  */
 public function boot()
 {
     // Register an autoloader for proxies to avoid issues when unserializing them
     // when the ORM is used.
     if ($this->container->hasParameter('doctrine.orm.proxy_namespace')) {
         $namespace = $this->container->getParameter('doctrine.orm.proxy_namespace');
         $dir = $this->container->getParameter('doctrine.orm.proxy_dir');
         $proxyGenerator = null;
         if ($this->container->getParameter('doctrine.orm.auto_generate_proxy_classes')) {
             // See https://github.com/symfony/symfony/pull/3419 for usage of references
             $container =& $this->container;
             $proxyGenerator = function ($proxyDir, $proxyNamespace, $class) use(&$container) {
                 $originalClassName = ClassUtils::getRealClass($class);
                 /** @var $registry Registry */
                 $registry = $container->get('doctrine');
                 // Tries to auto-generate the proxy file
                 /** @var $em \Doctrine\ORM\EntityManager */
                 foreach ($registry->getManagers() as $em) {
                     if (!$em->getConfiguration()->getAutoGenerateProxyClasses()) {
                         continue;
                     }
                     $metadataFactory = $em->getMetadataFactory();
                     if ($metadataFactory->isTransient($originalClassName)) {
                         continue;
                     }
                     $classMetadata = $metadataFactory->getMetadataFor($originalClassName);
                     $em->getProxyFactory()->generateProxyClasses(array($classMetadata));
                     clearstatcache(true, Autoloader::resolveFile($proxyDir, $proxyNamespace, $class));
                     break;
                 }
             };
         }
         $this->autoloader = Autoloader::register($dir, $namespace, $proxyGenerator);
     }
 }
开发者ID:BusinessCookies,项目名称:CoffeeMachineProject,代码行数:38,代码来源:DoctrineBundle.php

示例3: getRealClass

 public static function getRealClass($class)
 {
     if (class_exists('Doctrine\\Common\\Util\\ClassUtils')) {
         $class = DoctrineClassUtils::getRealClass($class);
     }
     return $class;
 }
开发者ID:anhpha,项目名称:reports,代码行数:7,代码来源:ClassUtils.php

示例4: resultatsLinkTerritoire

 public function resultatsLinkTerritoire($territoire)
 {
     switch (ClassUtils::getRealClass(get_class($territoire))) {
         case 'AppBundle\\Domain\\Territoire\\Entity\\Territoire\\CirconscriptionEuropeenne':
             $route = 'resultat_circo_europeenne';
             $parameters = array('code' => $territoire->getCode(), 'nom' => $this->slugify->slugify($territoire->getNom()));
             break;
         case 'AppBundle\\Domain\\Territoire\\Entity\\Territoire\\Commune':
             $route = 'resultat_commune';
             $parameters = array('departement' => $territoire->getDepartement()->getCode(), 'code' => $territoire->getCode(), 'nom' => $this->slugify->slugify($territoire->getNom()));
             break;
         case 'AppBundle\\Domain\\Territoire\\Entity\\Territoire\\Departement':
             $route = 'resultat_departement';
             $parameters = array('code' => $territoire->getCode(), 'nom' => $this->slugify->slugify($territoire->getNom()));
             break;
         case 'AppBundle\\Domain\\Territoire\\Entity\\Territoire\\Pays':
             $route = 'resultat_france';
             $parameters = array();
             break;
         case 'AppBundle\\Domain\\Territoire\\Entity\\Territoire\\Region':
             $route = 'resultat_region';
             $parameters = array('code' => $territoire->getCode(), 'nom' => $this->slugify->slugify($territoire->getNom()));
             break;
     }
     if (isset($route, $parameters)) {
         return $this->router->generate($route, $parameters);
     }
     return '';
 }
开发者ID:AlexisEidelman,项目名称:dataelections.fr,代码行数:29,代码来源:TerritoireExtension.php

示例5: canonicalName

 /**
  * {@inheritDoc}
  *
  * use getRealClass if className names a doctrine proxy class.
  */
 public function canonicalName($className)
 {
     $refl = new \ReflectionClass($className);
     if (in_array('Doctrine\\Common\\Persistence\\Proxy', $refl->getInterfaceNames())) {
         $className = \Doctrine\Common\Util\ClassUtils::getRealClass($className);
     }
     return $className;
 }
开发者ID:waifei,项目名称:createphp,代码行数:13,代码来源:BaseDoctrineRdfMapper.php

示例6: getOwnerType

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

示例7: getRealClass

 /**
  * Get real class name of a reference that could be a proxy
  *
  * @param string $className Class name of reference object
  *
  * @return string
  */
 protected function getRealClass($className)
 {
     if (Version::compare('2.2.0') <= 0) {
         return ClassUtils::getRealClass($className);
     }
     if (substr($className, -5) === 'Proxy') {
         return substr($className, 0, -5);
     }
     return $className;
 }
开发者ID:BusinessCookies,项目名称:CoffeeMachineProject,代码行数:17,代码来源:ProxyReferenceRepository.php

示例8: getGedmoConfig

 /**
  *
  * @param type $translatableClass
  * @return type
  */
 private function getGedmoConfig($translatableClass)
 {
     if (isset($this->gedmoConfig[$translatableClass])) {
         return $this->gedmoConfig[$translatableClass];
     }
     $translatableClass = \Doctrine\Common\Util\ClassUtils::getRealClass($translatableClass);
     $manager = $this->getManagerRegistry()->getManagerForClass($translatableClass);
     $this->gedmoConfig[$translatableClass] = $this->gedmoTranslatableListener->getConfiguration($manager, $translatableClass);
     return $this->gedmoConfig[$translatableClass];
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:15,代码来源:GedmoTranslationForm.php

示例9: getEntityClass

 /**
  * Gets a real class name for an entity.
  *
  * @param object|string $entityOrClass An entity object, entity class name or entity proxy class name
  *
  * @return string
  */
 public function getEntityClass($entityOrClass)
 {
     if (is_object($entityOrClass)) {
         return ClassUtils::getClass($entityOrClass);
     }
     if (strpos($entityOrClass, ':') !== false) {
         list($namespaceAlias, $simpleClassName) = explode(':', $entityOrClass, 2);
         return $this->registry->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName;
     }
     return ClassUtils::getRealClass($entityOrClass);
 }
开发者ID:woei66,项目名称:platform,代码行数:18,代码来源:DoctrineHelper.php

示例10: markDirty

 protected function markDirty(Identified $entity, array $data = [])
 {
     if (empty($entity->getId())) {
         throw new InvalidArgumentException('Entity has no identifier');
     }
     $class = ClassUtils::getRealClass(get_class($entity));
     $this->dirtyEntities[$class][$entity->getId()] = $data;
     if ($this->autoFlush) {
         $this->flushSync();
     }
 }
开发者ID:fprochazka,项目名称:posobota-rabbitmq-workshop-01-2016,代码行数:11,代码来源:BufferedQueue.php

示例11: createClassIdentity

 public function createClassIdentity($className)
 {
     $className = ClassUtils::getRealClass($className);
     if (isset($this->classCache[$className])) {
         return $this->classCache[$className];
     }
     if (null !== ($this->classCache[$className] = $this->classRepository->findOneByName($className))) {
         return $this->classCache[$className];
     }
     $classClass = $this->classRepository->getClassName();
     return $this->classCache[$className] = new $classClass($className);
 }
开发者ID:senthilkumar3282,项目名称:symfony-acl-bundle,代码行数:12,代码来源:TargetIdentityFactory.php

示例12: getRealClass

 /**
  * Gets the real class name of a class name that could be a proxy.
  *
  * @param string|object $object
  *
  * @return string
  */
 public static function getRealClass($object)
 {
     $class = is_object($object) ? get_class($object) : $object;
     if (class_exists('Doctrine\\Common\\Util\\ClassUtils')) {
         return DoctrineClassUtils::getRealClass($class);
     }
     // fallback in case doctrine common  is not installed
     if (false === ($pos = strrpos($class, '\\' . self::MARKER . '\\'))) {
         return $class;
     }
     return substr($class, $pos + self::MARKER_LENGTH + 2);
 }
开发者ID:royopa,项目名称:sigcm-angular,代码行数:19,代码来源:ClassUtils.php

示例13: handleCreateRequest

 /**
  * Create new
  *
  * @return Response
  */
 public function handleCreateRequest()
 {
     $entity = $this->getManager()->createEntity();
     $isProcessed = $this->processForm($entity);
     if ($isProcessed) {
         $entityClass = ClassUtils::getRealClass(get_class($entity));
         $classMetadata = $this->getManager()->getObjectManager()->getClassMetadata($entityClass);
         $view = $this->view($classMetadata->getIdentifierValues($entity), Codes::HTTP_CREATED);
     } else {
         $view = $this->view($this->getForm(), Codes::HTTP_BAD_REQUEST);
     }
     return $this->handleView($view);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:18,代码来源:RestController.php

示例14: getTranslatableFields

 /**
  *
  * @param type $translationClass
  * @return type
  */
 protected function getTranslatableFields($translationClass)
 {
     $translationClass = \Doctrine\Common\Util\ClassUtils::getRealClass($translationClass);
     $manager = $this->getManagerRegistry()->getManagerForClass($translationClass);
     $metadataClass = $manager->getMetadataFactory()->getMetadataFor($translationClass);
     $fields = array();
     foreach ($metadataClass->fieldMappings as $fieldMapping) {
         if (!in_array($fieldMapping['fieldName'], array('id', 'locale'))) {
             $fields[] = $fieldMapping['fieldName'];
         }
     }
     return $fields;
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:18,代码来源:DefaultTranslationForm.php

示例15: getRepository

 /**
  * @param EntityManagerInterface|EntityManager $entityManager
  * @param string $entityName
  * @return EntityRepository
  */
 public function getRepository(EntityManagerInterface $entityManager, $entityName)
 {
     if (is_object($entityName)) {
         $entityName = Doctrine\Common\Util\ClassUtils::getRealClass(get_class($entityName));
     }
     $entityName = ltrim($entityName, '\\');
     if (isset($this->repositoryList[$emId = spl_object_hash($entityManager)][$entityName])) {
         return $this->repositoryList[$emId][$entityName];
     }
     /** @var Doctrine\ORM\Mapping\ClassMetadata $metadata */
     $metadata = $entityManager->getClassMetadata($entityName);
     $repository = $this->createRepository($entityManager, $metadata);
     return $this->repositoryList[$emId][$entityName] = $repository;
 }
开发者ID:kdyby,项目名称:doctrine,代码行数:19,代码来源:RepositoryFactory.php


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