symfony/symfony — pull request #6337 by simensen (2012-12-13 20:00:35+00:00)
Title: [HttpKernel] Kernel can have its root directory specified.

Bug fix: no
Feature addition: yes
Backwards compatibility break: uncertain
Symfony2 tests pass: yes
Fixes the following tickets: n/a
License of the code: MIT
Documentation PR: n/a

---

I would like to be able to manually set kernel.root instead of having it magically determined for me. I laid out my reasons in great detail on the mailing list [here](https://groups.google.com/d/topic/symfony-devs/TJ47ghiZdmc/discussion) but I received no feedback. This is the least intrusive of the two solutions I have come up with.

My use case is distributing a default Kernel implementation that ultimately ends up in a project's vendor directory and not in `app/` like Symfony Standard expects. In this case it makes no sense to base the root directory on the physical location of the Kernel class.

All existing tests passed without modification. I added additional tests to ensure that things were behaving as expected.

I am uncertain if this constitutes an `@api` BC break but I am hopeful it does not. It adds one argument to the method signature, the new argument is optional, and the behavior when not specified is exactly the same behavior as before.

The only thing I am uncertain about is how this might impact Framework Bundle's `CacheClearCommand::getTempKernel` or anything else that might deal with cloning a kernel.