本文整理汇总了PHP中Schema::getDatabases方法的典型用法代码示例。如果您正苦于以下问题:PHP Schema::getDatabases方法的具体用法?PHP Schema::getDatabases怎么用?PHP Schema::getDatabases使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schema
的用法示例。
在下文中一共展示了Schema::getDatabases方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateCoughClassesFromSchema
/**
* Generates Cough classes from a Schema object.
*
* @param Schema $schema
* @return void
* @author Anthony Bush
**/
public function generateCoughClassesFromSchema(Schema $schema)
{
foreach ($schema->getDatabases() as $database) {
foreach ($database->getTables() as $table) {
$this->generateCoughClassesFromSchemaTable($table);
}
}
}
示例2: findTable
/**
* Scans the schema for the specified table name (or prefix + table name),
* starting with the given database and only scanning other databases if
* the table is not found there.
*
* @return mixed - SchemaTable if found, null if not
* @author Anthony Bush
**/
protected function findTable($tableNameMatch, SchemaTable $sourceTable)
{
$firstDatabase = $sourceTable->getDatabase();
$table = $this->findTableInDatabase($tableNameMatch, $firstDatabase);
if (is_null($table)) {
// Try again for every other database
$firstDatabaseName = $firstDatabase->getDatabaseName();
foreach ($this->schema->getDatabases() as $dbName => $database) {
if ($dbName == $firstDatabaseName || !$this->config->shouldScanForJoin($sourceTable, $database)) {
continue;
}
$table = $this->findTableInDatabase($tableNameMatch, $database);
if (!is_null($table)) {
break;
}
}
}
return $table;
}