Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Fixes ensureDependenciesExist runtime error #43626

Merged
merged 1 commit into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/Illuminate/Database/Console/DatabaseInspectionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,15 @@ protected function getConfigFromDatabase($database)
/**
* Ensure the dependencies for the database commands are available.
*
* @return int|null
* @return bool
*/
protected function ensureDependenciesExist()
{
if (! interface_exists('Doctrine\DBAL\Driver')) {
if (! $this->components->confirm('Displaying model information requires the Doctrine DBAL (doctrine/dbal) package. Would you like to install it?')) {
return 1;
return tap(interface_exists('Doctrine\DBAL\Driver'), function ($dependenciesExist) {
if (! $dependenciesExist && $this->components->confirm('Inspecting database information requires the Doctrine DBAL (doctrine/dbal) package. Would you like to install it?')) {
$this->installDependencies();
}

return $this->installDependencies();
}
});
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Database/Console/ShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class ShowCommand extends DatabaseInspectionCommand
*/
public function handle(ConnectionResolverInterface $connections)
{
$this->ensureDependenciesExist();
if (! $this->ensureDependenciesExist()) {
return 1;
}

$connection = $connections->connection($database = $this->input->getOption('database'));

Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Database/Console/TableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class TableCommand extends DatabaseInspectionCommand
*/
public function handle(ConnectionResolverInterface $connections)
{
$this->ensureDependenciesExist();
if (! $this->ensureDependenciesExist()) {
return 1;
}

$connection = $connections->connection($this->input->getOption('database'));

Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Foundation/Console/ShowModelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ class ShowModelCommand extends DatabaseInspectionCommand
*/
public function handle()
{
$this->ensureDependenciesExist();
if (! $this->ensureDependenciesExist()) {
return 1;
}

$class = $this->qualifyModel($this->argument('model'));

Expand Down