User tests: Successful: Unsuccessful:
Factory::getApplication();
doesn't take any arguments anymore and will return always the global application object which must be set by the front controller during the set up phase. The problem on that part in J3 is that the code
$app = JFactory::getApplication('site');
$app = JFactory::getApplication('administrator');
echo $app->getName();
// Returns site and not administrator
will always return the site app, despite the administrator app is requested. This can be done now trough Factory::getContainer()->get('SiteApplication');
which will return a site application even on the back end.
I'm splitting #16918 into different pr's to be easier to review.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Installation Libraries |
If we are removing the app singletons we need to ensure that running the app constructors multiple times doesn't create side effects on the primary app and dependencies.
Labels |
Added:
?
|
CMSApplication::getInstance
is deprecated anyway in favor of getting them from the container. If we need singletons, then we can make them shared in the container?
Most of the container services are shared already anyway. But even outside of that, my point isn't about having singletons but about ensuring that running new SiteApplication
multiple times doesn't cause issues because there is some arbitrary logic in the constructors that can affect global services like the session.
I guess we should keep CMSApplication::getInstance
for BC during the 4 series. This would avoid then having multiple applications or?
Ahh i missed CMSApplication::getInstance
was checking in the container. Sorry. Then I guess this is fine
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-02-02 16:22:19 |
Closed_By | ⇒ | wilsonge |
Regardless of whether the getInstance method lives forever or disappears tomorrow, we still need to ensure that running the constructors multiple times doesn't create side effects. That is the only concern with removing this specific singleton store, every other service that has singleton doesn't have global reach like the application does.
Joomla\CMS\Uri\Uri::root()
This is a move in the right direction, just pointing out technical concerns in getting to the end state.
Needs the "Documentation Required" label.
Right.
So if we do this do we actually want to have the
CMSApplication::getInstance
method at all? Because that's going to be totally unused. Thoughts @mbabker