Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 May 2013 at 13:10 UTC
Updated:
29 Jul 2014 at 22:26 UTC
Jump to comment: Most recent file
Comments
Comment #1
wesleydv commentedComment #2
rbayliss commentedNice, but you should probably use the specific methods on the Drupal object for module handler and key/value.
Drupal::moduleHandler()->...
Drupal::keyValue()->...
Comment #3
rbayliss commentedReroll with changes from #2, and using Drupal::getContainer() wherever we were needing to return the whole container. It's deprecated, but there's currently no other way.
Comment #4
wesleydv commentedI believe the question is should: Drupal::getContainer() be deprecated?
If a function is vital for Drupal and there is no other way to do it, it does not seem right to deprecate that function in the first place.
Is using
static::$container;directly an alternative?Comment #5
ddrozdik commentedI will add this task to meta task #2001206: Replace drupal_container() with Drupal::service() as part of same work in other places.
Comment #6
Crell commentedDrupal::moduleHandler()
$module_handler = Drupal::moduleHandler();
$module_handler->moduleExists()
// etc.
Using Drupal::getContainer() is very discouraged, but in early bootstrap we sometimes don't have another option. We can leave those in here for the time being. If it can get refactored later, that's for later.
Comment #7
kgoel commentedComment #9
kgoel commented#7: bootstrap-2006024-7.patch queued for re-testing.
Comment #11
kgoel commentedI am not sure why Drupal installation failed. In this patch I have removed deprecated drupal_container function from bootstrap.inc.
Comment #13
Crell commentedThere is no such function. I think you mean Drupal::getContainer().
Ibid.
We can't remove this yet. Just stop using it.
Comment #14
kgoel commentedComment #15
Crell commentedWhy did this patch shrink so much from #3? Did the rest get committed elsewhere?
Comment #16
kgoel commented@Crell - I am not sure where the rest of the code got committed. I ran grep on drupal_container and found only three instances of it in bootstrap.inc file.
Comment #17
Crell commentedhuh. Well, OK, as long as it got done. :-)
Comment #18
Crell commented#14: bootstrap-2006024-14.patch queued for re-testing.
Comment #19
catchCommitted/pushed to 8.x, thanks!