Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[RFC] Deprecate Kernel::getRootDir? #24293

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

Closed
ro0NL opened this issue Sep 22, 2017 · 10 comments
Closed

[RFC] Deprecate Kernel::getRootDir? #24293

ro0NL opened this issue Sep 22, 2017 · 10 comments

Comments

@ro0NL
Copy link
Contributor

ro0NL commented Sep 22, 2017

Q A
Bug report? no
Feature request? no
BC Break report? no
RFC? yes
Symfony version 3.x

Should we deprecate Kernel::getRootDir()? With the new structure and Kernel living in src/ this will basically point to some arbitrary namespace path. Im not even sure core still uses/needs it, having getProjectDir() also.

I think also any dirname(__DIR__) call in https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/3.3/src/Kernel.php should be replaced by that (getProjectDir).

@stof
Copy link
Member

stof commented Sep 25, 2017

The hard part of the deprecation will be deprecating the kernel.root_dir parameter in the container.
We don't have a way to deprecate DIC parameters currently. And it will be hard to build such feature before the 3.4 feature freeze (which is planned for the end of the week according to the roadmap)

@ro0NL
Copy link
Contributor Author

ro0NL commented Sep 25, 2017

Milestone updated to 3.x :) perhaps be pragmatic on parameters? As of 4.0 kernel.root_dir is just gone. Code wise there's no BC break, so perhaps we can do this with a CHANGELOG entry.

While deprecating public calls to getRootDir() only.

@stof
Copy link
Member

stof commented Sep 25, 2017

Removing a parameter is a BC break, as it breaks all bundles relying on it (and there are a lot.

@chalasr
Copy link
Member

chalasr commented Sep 28, 2017

Removing kernel.root_dir would be a huge breaking change. I think it's worth having a mechanism for deprecating parameters, at least for core.

@ro0NL
Copy link
Contributor Author

ro0NL commented Sep 28, 2017

It's a useless path IMHO; superseded by project_dir. But deprecation path might not be worth it, as indeed the params are kinda problematic.

But yeah, the path would be to use project_dir probably.

Related to #24292 now, if we want to get rid of kernel.name.

@ro0NL
Copy link
Contributor Author

ro0NL commented Nov 13, 2017

From @wouterj on slack

Does anyone know the status of the kernel.root_dir parameter? It's marked deprecated in 3.3, but it seems to still be available in 4.0.0-BETA3. Can I keep using it in my bundle in Symfony 4?

Then i remembered #22315 (comment)

Basically %kernel.root_dir% is already deprecated.. 😓 not sure how that reflects this PR, or getRootDir() at all 😕

@nicolas-grekas
Copy link
Member

I think we actually failed to remove the parameter even in 4.0...

@mariusbalcytis
Copy link

Actually, I think UPGRADE.md should be fixed to remove the statement that is not true. It's misleading and complicates the work taken in migration to 4.0 compatibility.

Furthermore, other Symfony bundles (in 4.x branch) also still use this parameter.

https://github.com/symfony/symfony/blob/master/UPGRADE-4.0.md#httpkernel

Removed the kernel.root_dir parameter. Use the kernel.project_dir parameter instead.
Removed the Kernel::getRootDir() method. Use the Kernel::getProjectDir() method instead.

But both are there on 4.0:
https://github.com/symfony/http-kernel/blob/master/Kernel.php#L545

@ro0NL
Copy link
Contributor Author

ro0NL commented Nov 29, 2017

remove the statement that is not true

Technically you're right, however i think its intention is to not start using %kernel.root_dir% as of 3.3. Then again.. SF itself is still using it :)

Perhaps do what we always do; revert the "virtual" deprecation now, and bring in a feature to deprecate di params first. Or dont deprecate the param.

@nicolas-grekas
Copy link
Member

Let's drop that line from UPGRADE/CHANGELOG files yes.

@fabpot fabpot closed this as completed Oct 16, 2018
fabpot added a commit that referenced this issue Oct 16, 2018
…l.root_dir (fabpot)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[HttpKernel] Deprecate usage of getRootDir() and kernel.root_dir

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #24293
| License       | MIT
| Doc PR        | n/a

<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
 - Bug fixes must be submitted against the lowest branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against the master branch.
-->

Commits
-------

0b851c6 [HttpKernel] deprecated usage of getRootDir() and kernel.root_dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants