本文整理汇总了PHP中Symfony\Bridge\Doctrine\ManagerRegistry::getManagers方法的典型用法代码示例。如果您正苦于以下问题:PHP ManagerRegistry::getManagers方法的具体用法?PHP ManagerRegistry::getManagers怎么用?PHP ManagerRegistry::getManagers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Bridge\Doctrine\ManagerRegistry
的用法示例。
在下文中一共展示了ManagerRegistry::getManagers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isKnownEntityClassNamespace
/**
* Checks whether the given namespace is registered in the Doctrine
*
* @param string $namespace
* @return bool
*/
public function isKnownEntityClassNamespace($namespace)
{
foreach (array_keys($this->doctrine->getManagers()) as $name) {
$namespaces = $this->doctrine->getManager($name)->getConfiguration()->getEntityNamespaces();
if (in_array($namespace, $namespaces, true)) {
return true;
}
}
return false;
}
示例2: loadNameMaps
/**
* Loads table name <-> entity class name maps
*/
protected function loadNameMaps()
{
$this->tableToClassMap = [];
$this->classToTableMap = [];
$names = array_keys($this->doctrine->getManagers());
foreach ($names as $name) {
$manager = $this->doctrine->getManager($name);
if ($manager instanceof EntityManager) {
$allMetadata = $this->getAllMetadata($manager);
foreach ($allMetadata as $metadata) {
$tableName = $metadata->getTableName();
if (!empty($tableName)) {
$className = $metadata->getName();
$this->tableToClassMap[$tableName] = $className;
$this->classToTableMap[$className] = $tableName;
}
}
}
}
}