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

Move symfony/yaml into Dev Requirements #589

Merged
merged 1 commit into from
Jan 4, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@
"require": {
"php": "^7.1",
"doctrine/dbal": "~2.6",
"symfony/yaml": "~3.3|^4.0",
"symfony/console": "~3.3|^4.0",
"ocramius/proxy-manager": "^1.0|^2.0"
},
"require-dev": {
"doctrine/orm": "~2.5",
"symfony/yaml": "~3.3|^4.0",
"phpunit/phpunit": "~6.2",
"doctrine/coding-standard": "^1.0",
"jdorn/sql-formatter": "~1.1",
"mikey179/vfsStream": "^1.6",
"squizlabs/php_codesniffer": "^3.0"
},
"suggest": {
"jdorn/sql-formatter": "Allows to generate formatted SQL with the diff command."
"jdorn/sql-formatter": "Allows to generate formatted SQL with the diff command.",
"symfony/yaml": "Allows the use of yaml for migration configuration files."
},
"autoload": {
"psr-4": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use Symfony\Component\Yaml\Yaml;

use Doctrine\DBAL\Migrations\MigrationException;

/**
* Load migration configuration information from a YAML configuration file.
*
Expand All @@ -19,6 +21,10 @@ class YamlConfiguration extends AbstractFileConfiguration
*/
protected function doLoad($file)
{
if ( ! class_exists(Yaml::class)) {
throw MigrationException::yamlConfigurationNotAvailable();
}

$config = Yaml::parse(file_get_contents($file));

if ( ! is_array($config)) {
Expand Down
5 changes: 5 additions & 0 deletions lib/Doctrine/DBAL/Migrations/MigrationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public static function configurationFileAlreadyLoaded()
return new self(sprintf('Migrations configuration file already loaded'), 8);
}

public static function yamlConfigurationNotAvailable() : self
{
return new self('Unable to load yaml configuration files, please `composer require symfony/yaml` load yaml configuration files');
}

public static function configurationIncompatibleWithFinder(
$configurationParameterName,
MigrationFinderInterface $finder
Expand Down