-
-
Notifications
You must be signed in to change notification settings - Fork 217
Symfony 5 parameter fix #295
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ public function getConfigTreeBuilder() : TreeBuilder | |
|
||
$rootNode | ||
->children() | ||
->scalarNode('dir_name')->defaultValue('%kernel.root_dir%/DoctrineMigrations')->cannotBeEmpty()->end() | ||
->scalarNode('dir_name')->defaultValue('%doctrine.migrations.dir%')->cannotBeEmpty()->end() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to stick with the naming of the other parameters I would name this one |
||
->scalarNode('namespace')->defaultValue('Application\Migrations')->cannotBeEmpty()->end() | ||
->scalarNode('table_name')->defaultValue('migration_versions')->cannotBeEmpty()->end() | ||
->scalarNode('column_name')->defaultValue('version')->end() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,12 @@ public function load(array $configs, ContainerBuilder $container) : void | |
{ | ||
$configuration = new Configuration(); | ||
|
||
if ($container->hasParameter('kernel.root_dir')) { | ||
$container->setParameter('doctrine.migrations.dir', '%kernel.root_dir%/DoctrineMigrations'); | ||
} else { | ||
$container->setParameter('doctrine.migrations.dir', '%kernel.project_dir%/src/Migrations'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for the late response. As far as I can see this would still be a BC break for someone having an application that uses the old directory layout (i.e. they only updated their dependencies, but didn't adapt the directory structure established with Symfony Flex). I think the only safe upgrade path is to deprecate not configuring this option and making it a mandatory one in the next major release. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed @xabbuh is right 😢 This will break for people with the old directory structure that just move to Symfony 5 without adapting to the new structure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'll defer this to @goetas, since the next major release will change the config format anyways. We may just want to ignore this for now and fix it properly in 3.0. |
||
} | ||
|
||
$config = $this->processConfiguration($configuration, $configs); | ||
|
||
foreach ($config as $key => $value) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be a BC break? The code below seems to replace/resolve parameter placeholders with kernel parameters. So now this will not work anymore if my Symfony 3.4 project relies on
%kernel.root_dir%
to be replaced here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I think for now we can just add
kernel.project_dir
to the array but also keepkernel.root_dir
. There is a check below that ensures the kernel parameter exists.