-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Corrected wrong class used in "Locating Resources" #11969
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
@filip-t thanks for fixing this bug! You are right that |
But HttpKernel/Kernel is an abstract class. I tried to use it, but it didn't work. Using KernelInterface fixed the problem. I'm not sure it's the correct way to do it, but this is the only way I could make it work. |
An interface is not an instantiable object. You should use the Kernel of the project : |
Firstly - I just realised I forked Symfony 3.4, not 4.3, as I intended to do. I don't know how that happened. Looks like this applies to both versions. |
@nicolas-grekas this looks good to me can you confirm please? Thank you |
|
||
// ... | ||
$kernel = new HttpKernel($dispatcher, $resolver); | ||
$kernel = new Kernel($dispatcher, $resolver); |
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.
that cannot be correct: Kernel doesn't take these as arguments
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.
Hmm you are right... 🤔
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.
The more I look at this, the more problems I see with my request. Maybe this code example should be rewritten from scratch? I don't really see anybody creating a new Kernel
instance just to get a path to a config file.
553a597
to
0a7b27a
Compare
…p-t) This PR was squashed before being merged into the 3.4 branch (closes #11969). Discussion ---------- Corrected wrong class used in "Locating Resources" HttpKernel does not contain a locateResource method. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- 0a7b27a Corrected wrong class used in \"Locating Resources\"
@filip-t in practice you need to get the entire kernel instance to use the $path = $kernel->locateResource('@AppBundle/Resources/config/services.xml'); |
HttpKernel does not contain a locateResource method.