本文整理匯總了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;
}
}
}
}
}