Skip to content

Commit 8ba049b

Browse files
Fixed undefined array key mariadb10|11 error on installation. (#703)
1 parent 481a448 commit 8ba049b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/Console/Concerns/InteractsWithDockerComposeServices.php

+18-1
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,25 @@ protected function buildDockerCompose(array $services)
8282
->all();
8383
}
8484

85+
// Update the dependencies if the MariaDB service is used...
86+
if (in_array('mariadb10', $services) || in_array('mariadb11', $services)) {
87+
$compose['services']['laravel.test']['depends_on'] = array_map(function ($dependedItem) {
88+
if (in_array($dependedItem, ['mariadb10', 'mariadb11'])) {
89+
return 'mariadb';
90+
}
91+
92+
return $dependedItem;
93+
}, $compose['services']['laravel.test']['depends_on']);
94+
}
95+
8596
// Add the services to the docker-compose.yml...
8697
collect($services)
8798
->filter(function ($service) use ($compose) {
8899
return ! array_key_exists($service, $compose['services'] ?? []);
89100
})->each(function ($service) use (&$compose) {
90-
$compose['services'][$service] = Yaml::parseFile(__DIR__ . "/../../../stubs/{$service}.stub")[$service];
101+
in_array($service, ['mariadb10', 'mariadb11'])
102+
? $compose['services']['mariadb'] = Yaml::parseFile(__DIR__ . "/../../../stubs/{$service}.stub")['mariadb']
103+
: $compose['services'][$service] = Yaml::parseFile(__DIR__ . "/../../../stubs/{$service}.stub")[$service];
91104
});
92105

93106
// Merge volumes...
@@ -97,6 +110,10 @@ protected function buildDockerCompose(array $services)
97110
})->filter(function ($service) use ($compose) {
98111
return ! array_key_exists($service, $compose['volumes'] ?? []);
99112
})->each(function ($service) use (&$compose) {
113+
if (in_array($service, ['mariadb10', 'mariadb11'])) {
114+
$service = 'mariadb';
115+
}
116+
100117
$compose['volumes']["sail-{$service}"] = ['driver' => 'local'];
101118
});
102119

0 commit comments

Comments
 (0)