JREQUEST-MEMBERS-001
JRequest::getInt()
JRequest::getInt / getCmd / getWord / get / set / getMethod
The entire JRequest API died with the class. People search getInt even when they already know getVar is dead.
JRequest::getInt() → $app->getInput()->get('x', 0, 'INT')
What you will see
- Call to undefined method JRequest::getInt
- Call to undefined method JRequest::getCmd
- Call to undefined method JRequest::getWord
- Call to undefined method JRequest::getMethod
- Call to undefined method JRequest::setVar
Symptoms people search
getInt not found · getCmd · getWord · JRequest::get(
Replace this code
Swap JRequest::getInt() for $app->getInput()->get('x', 0, 'INT').
Joomla 3
Remove or stop calling this
$id = JRequest::getInt('id');
$task = JRequest::getCmd('task');
$word = JRequest::getWord('layout');
$all = JRequest::get('post');
JRequest::setVar('id', 1);
$method = JRequest::getMethod();Joomla 4 / 6
Use this instead
$input = Factory::getApplication()->getInput();
$id = $input->getInt('id');
$task = $input->getCmd('task');
$word = $input->getWord('layout');
$post = $input->post->getArray();
$input->set('id', 1);
$method = $input->getMethod();How to fix it
- 1Same as JRequest::getVar: use Input.
- 2Map getInt→getInt, getCmd→getCmd, getWord→getWord.
Also known as
getInt · getCmd · getWord · getFloat · getBool · getString · setVar · getMethod · JRequest::get
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()