-
-
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
Conversation
The parameter was introduced in symfony/symfony#22315 , and available since 3.4.0 , so I think this should target 2.1.x instead of master. |
Changed. I think I changed it well. |
Changing the base branch is the first step, and you did it correctly. The second step is to get rid of commits that are on master and which you did not author
|
It's too hard for me :< Sorry, I give up :/ |
Don't worry, I will do it for you |
All is well now, although a bit confusing because you used your |
Thank you. |
Can We finish this PR ? |
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.
👍
@@ -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 comment
The 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 %doctrine_migrations.default_dir_name%
@@ -45,7 +45,7 @@ public static function configureMigrations(ContainerInterface $container, Config | |||
$configuration->setMigrationsDirectory($dir); | |||
} else { | |||
// class Kernel has method getKernelParameters with some of the important path parameters | |||
$pathPlaceholderArray = ['kernel.root_dir', 'kernel.cache_dir', 'kernel.logs_dir']; | |||
$pathPlaceholderArray = ['kernel.project_dir', 'kernel.cache_dir', 'kernel.logs_dir']; |
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 keep kernel.root_dir
. There is a check below that ensures the kernel parameter exists.
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 comment
The 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
So what about this PR ? I can't bump to SF5 due to kernel.root_dir which does not exist. |
Related to symfony/symfony#28810