JFACTORY-GETDOCUMENT-001
JFactory::getDocument()
Factory::getDocument()
Document is owned by the application. Factory::getDocument() is deprecated.
JFactory::getDocument() → $app->getDocument()
What you will see
- Factory::getDocument is deprecated
Symptoms people search
getDocument deprecation
Replace this code
Swap JFactory::getDocument() for $app->getDocument().
Joomla 3
Remove or stop calling this
$doc = JFactory::getDocument();
$doc->setTitle('Courses');Joomla 4 / 6
Use this instead
$doc = Factory::getApplication()->getDocument();How to fix it
- 1Use $app->getDocument().
Also known as
getDocument
Related issues
- Joomla 3 → 4Joomla API
JRequest::getVar() and the whole JRequest API
JRequest::getVar() → $app->getInput()->get('id')
- Joomla 3 → 4Joomla API
JError / JException
JError::raiseError() → throw new RuntimeException() / try-catch
- Joomla 3 → 4Joomla API
isAdmin() / isSite()
$app->isAdmin() → $app->isClient('administrator') / isClient('site')
- Joomla 3 → 4Joomla API
Factory::getUri()
JFactory::getUri() → Uri::getInstance()
- Joomla 3 → 4Joomla API
Factory::getXml() / JXMLElement
JFactory::getXML() → SimpleXMLElement
- Joomla 3 → 4Joomla API
Factory::getEditor()
JFactory::getEditor() → Editor::getInstance()