User tests: Successful: Unsuccessful:
Pull Request resolves # .
The SiteApplication, AdministratorApplication, and ApiApplication all called $this->loadDocument() without passing $document argument, causing an internal fallback to the deprecated method Factory::getDocument() call.
This PR introduces createDocument() method on CMSApplication to create document object which bring the following improvements:
Factory::getDocument() which was planned to remove in Joomla 7Works. But use deprecated code for creating document object for application
Works without using deprecated code for creating document object for application
Please select:
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries |
| Labels |
Added:
PR-6.2-dev
|
||
| Labels |
Added:
Architecture
|
||
| Category | Libraries | ⇒ | Installation Libraries |
| Category | Libraries Installation | ⇒ | Libraries |
I would not make the createDocument function in the application class public. But I do agree that the factory should use the document from the app and not vice versa. Therefore we can remove createDocument in the Factory and route getDocument in factory to the app.
Thanks for the feedback. Below are details response:
I would suggest change the Factory::getDocument() and Factory::createDocument() to use the "new application" methods, so we have only one location where a document is created.
This is not safe. The "new application" needs language available in application to create document. That is only available after application Initialise phase. So if someone calls Factory::getDocument() before that for whatever reason, it will be broken.
Additionally I would move createDocument() to WebApplication and also move the loadDocument change to the WebApplication.
This is not possible because WebApplication does not have container injected, so we do not have necessary services to create documents there.
I would not make the createDocument function in the application class public
Yes, that could not be public because it can only be used at certain phase in application life cycle. It is protected on purpose and can only be used internal for now.
I would suggest change the
Factory::getDocument()andFactory::createDocument()to use the "new application" methods, so we have only one location where a document is created.Additionally I would move
createDocument()toWebApplicationand also move theloadDocumentchange to theWebApplication.Additonally wrap all
Factory::$document = $documentcode into the "b/c plugin switch"COMPAT_JOOMLA_7.reference: #47911
and I think move it to 7.0