當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。