{"action":"closed","issue":{"url":"https://api.github.com/repos/doctrine/DoctrineMigrationsBundle/issues/150","repository_url":"https://api.github.com/repos/doctrine/DoctrineMigrationsBundle","labels_url":"https://api.github.com/repos/doctrine/DoctrineMigrationsBundle/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/doctrine/DoctrineMigrationsBundle/issues/150/comments","events_url":"https://api.github.com/repos/doctrine/DoctrineMigrationsBundle/issues/150/events","html_url":"https://github.com/doctrine/DoctrineMigrationsBundle/issues/150","id":134221099,"number":150,"title":"Migrations --configuration namespace","user":{"login":"LogansUA","id":7515743,"avatar_url":"https://avatars.githubusercontent.com/u/7515743?v=3","gravatar_id":"","url":"https://api.github.com/users/LogansUA","html_url":"https://github.com/LogansUA","followers_url":"https://api.github.com/users/LogansUA/followers","following_url":"https://api.github.com/users/LogansUA/following{/other_user}","gists_url":"https://api.github.com/users/LogansUA/gists{/gist_id}","starred_url":"https://api.github.com/users/LogansUA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LogansUA/subscriptions","organizations_url":"https://api.github.com/users/LogansUA/orgs","repos_url":"https://api.github.com/users/LogansUA/repos","events_url":"https://api.github.com/users/LogansUA/events{/privacy}","received_events_url":"https://api.github.com/users/LogansUA/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-17T09:05:54Z","updated_at":"2016-02-17T11:38:13Z","closed_at":"2016-02-17T11:38:13Z","body":"So, hello there.\r\n\r\nMy project configurations:\r\n* symfony/symfony v2.8.2\r\n* doctrine/doctrine-migrations-bundle 1.1.1\r\n\r\nYesterday i was trying to split databases on my project. In order to do that i need to execute specific pack of migrations on specific database so i start digging.\r\n\r\nI found this [issue](https://github.com/doctrine/DoctrineMigrationsBundle/issues/38) and related [pull request](https://github.com/doctrine/DoctrineMigrationsBundle/pull/46) and i found [answer](https://github.com/doctrine/DoctrineMigrationsBundle/pull/46#issuecomment-75542424) but when i was trying to implement that i found bug (or feature :smile:).\r\n\r\nSo i create configuration file like that:\r\n```YML\r\n# My Entity Manager Doctrine Migrations Configuration\r\nmigrations_directory: \"app/DoctrineMigrations/MyEntityManager\"\r\nmigrations_namespace: Application\\Migrations\\MyEntityManager\r\n```\r\n\r\nAnd i got this `MigrationException`\r\n```                                                                  \r\n  [Doctrine\\DBAL\\Migrations\\MigrationException]                                 \r\n  Migrations namespace must be configured in order to use Doctrine migrations.\r\n```\r\n\r\nWell. As i'm some king of \"digging expert\" i get to the exception trace and found this interesting thing.\r\n\r\nIn file `AbstractFileConfiguration` line `61` there is `setConfiguration(Array $config)` function that goes through array of parameters and call specific function for specific config key.\r\n\r\n```PHP\r\n/**\r\n * @var array of possible configuration properties in migrations configuration.\r\n */\r\nprivate $configurationProperties = [\r\n    'name'                 => 'setName',\r\n    'table_name'           => 'setMigrationsTableName',\r\n    'migrations_namespace' => 'setMigrationsNamespace',\r\n    'organize_migrations'  => 'setMigrationOrganisation',\r\n    'migrations_directory' => 'loadMigrationsFromDirectory',\r\n    'migrations'           => 'loadMigrations',\r\n];\r\n```\r\n\r\nSo when it gets to my first config parameter (`migrations_directory`) it calls `loadMigrationsFromDirectory` function which calls `registerMigrationsFromDirectory` (line `75` of `AbstractFileConfiguration`) and this function calls `validate` function (:smile:) which start to check for `migrations_namespace` value (file `Configuration` line `185`) but for now the `setConfiguration` didn't set this value so it's throw an `MigrationException`.\r\n\r\nSetting keys in another order solves this thing:\r\n```YML\r\n# My Entity Manager Doctrine Migrations Configuration\r\nmigrations_namespace: Application\\Migrations\\MyEntityManager\r\nmigrations_directory: \"app/DoctrineMigrations/MyEntityManager\"\r\n```\r\n\r\nSo this is it.\r\n\r\nP.S. I think that this [PR](https://github.com/doctrine/DoctrineMigrationsBundle/pull/46) idea is definitely better because:\r\n* It's really easy to use\r\n* When you'll using `diff` (with `--em` key) command you will always be confident that migration will be created only for this connection and placed in directory for this connection, because now you can accidentally forget about `--configuration` key and it will be created in wrong place.\r\n\r\nP.S.S. Also it would be great if we have some paragraph in docs about configuration file which should be used for `--configuration` key because i see that there are 6 of configuration keys like\r\n```\r\nname\r\ntable_name\r\nmigrations_namespace\r\norganize_migrations\r\nmigrations_directory\r\nmigrations\r\n```\r\nbut i saw only 4 of them in this [comment](https://github.com/doctrine/DoctrineMigrationsBundle/pull/46#issuecomment-75542424) and [here](http://stackoverflow.com/questions/16640503/doctrine-migrations-namespace-error)"}}