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


PHP ManagerRegistry::getAliasNamespace方法代码示例

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


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

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

示例2: getEntityClass

 /**
  * Gets the full class name for the given entity
  *
  * @param string $entityName The name of the entity. Can be bundle:entity or full class name
  * @return string The full class name
  * @throws \InvalidArgumentException
  */
 public function getEntityClass($entityName)
 {
     $split = explode(':', $entityName);
     if (count($split) <= 1) {
         // The given entity name is not in bundle:entity format. Suppose that it is the full class name
         return $entityName;
     } elseif (count($split) > 2) {
         throw new \InvalidArgumentException(sprintf('Incorrect entity name: %s. Expected the full class name or bundle:entity.', $entityName));
     }
     return $this->doctrine->getAliasNamespace($split[0]) . '\\' . $split[1];
 }
开发者ID:xamin123,项目名称:platform,代码行数:18,代码来源:EntityClassResolver.php

示例3: getRepository

 /**
  * Returns custom repository if one specified otherwise returns a basic repository.
  *
  * {@inheritdoc}
  */
 public function getRepository($entityName)
 {
     $realEntityName = $entityName;
     if (strpos($entityName, ':') !== false) {
         list($namespaceAlias, $simpleClassName) = explode(':', $entityName);
         $realEntityName = $this->managerRegistry->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName;
     }
     if (isset($this->entities[$realEntityName])) {
         $realEntityName = $this->entities[$realEntityName];
     }
     return $this->repositoryManager->getRepository($realEntityName);
 }
开发者ID:alekitto,项目名称:FOSElasticaBundle,代码行数:17,代码来源:RepositoryManager.php


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