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

add possibility to read doctrine's config/cli-config.php #404

Merged
merged 1 commit into from
Jan 5, 2016
Merged
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
23 changes: 17 additions & 6 deletions bin/doctrine-migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,16 @@
}

// Support for using the Doctrine ORM convention of providing a `cli-config.php` file.
$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
$directories = array(getcwd(), getcwd() . DIRECTORY_SEPARATOR . 'config');

$configFile = null;
foreach ($directories as $directory) {
$configFile = $directory . DIRECTORY_SEPARATOR . 'cli-config.php';

if (file_exists($configFile)) {
break;
}
}

$helperSet = null;
if (file_exists($configFile)) {
Expand All @@ -48,12 +57,14 @@
);
}

require $configFile;
$helperSet = require $configFile;

foreach ($GLOBALS as $helperSetCandidate) {
if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
$helperSet = $helperSetCandidate;
break;
if ( ! ($helperSet instanceof \Symfony\Component\Console\Helper\HelperSet)) {
foreach ($GLOBALS as $helperSetCandidate) {
if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
$helperSet = $helperSetCandidate;
break;
}
}
}
}
Expand Down