Skip to content

Commit a90ff56

Browse files
committed
Fix
1 parent 6c91113 commit a90ff56

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

src/Data/Schema.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
namespace Bekwoh\LaravelDbDoc\Data;
44

5+
use Illuminate\Support\Collection;
6+
57
class Schema
68
{
9+
protected Collection $collections;
10+
711
public function __construct(protected $tables, protected $schema)
812
{
913
}
@@ -18,7 +22,7 @@ public function getData()
1822
$tables = $this->tables;
1923
$schema = $this->schema;
2024

21-
$this->collections = [];
25+
$this->collections = collect();
2226
foreach ($tables as $table) {
2327
$columns = $schema->listTableColumns($table);
2428
$foreignKeys = collect($schema->listTableForeignKeys($table))->keyBy(function ($foreignColumn) {
@@ -45,7 +49,7 @@ public function getData()
4549
}
4650
}
4751

48-
return $this->collections;
52+
return $this->collections->toArray();
4953
}
5054

5155
private function determineUnsigned($column)

src/LaravelDbDoc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static function routes()
3232
}
3333
}
3434

35-
public function content($format)
35+
public static function content($format)
3636
{
3737
throw_if(! in_array($format, ['json', 'markdown']));
3838

src/Processor.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ class Processor
1010
{
1111
protected array $data;
1212

13+
protected $schema;
14+
protected $tables;
15+
protected $connection;
16+
protected $database_connection;
17+
1318
protected string $presenter;
1419

1520
public function __construct()
@@ -43,15 +48,15 @@ public function render()
4348
->write();
4449
}
4550

46-
public function connect(string $connection, string $format): self
51+
public function connect(string $database_connection, string $format): self
4752
{
48-
$this->database_connection = $connection;
53+
$this->database_connection = $database_connection;
4954
$this->presenter = config('db-doc.presentations.'.$format.'.class');
5055

5156
throw_if(! class_exists($this->presenter), 'RuntimeException', "$this->presenter not exists.");
5257

5358
$this->connection = DB::connection($this->database_connection)->getDoctrineConnection();
54-
$this->schema = $this->connection->getSchemaManager();
59+
$this->schema = $this->connection->createSchemaManager();
5560
$this->tables = $this->schema->listTableNames();
5661

5762
return $this;

0 commit comments

Comments
 (0)