MVC-GETINSTANCE-001
JModelLegacy::getInstance()
getInstance() on MVC classes
String getInstance on models/controllers/views is deprecated. MVC Factory resolves namespaced classes.
JModelLegacy::getInstance() → $this->getModel() / MVCFactory
What you will see
- Model class not found
Symptoms people search
getInstance model · cannot load model after namespace
Replace this code
Swap JModelLegacy::getInstance() for $this->getModel() / MVCFactory.
Joomla 3
Remove or stop calling this
$model = JModelLegacy::getInstance('Courses', 'LmsModel');Joomla 4 / 6
Use this instead
$model = $this->getModel('Courses');How to fix it
- 1Use $this->getModel() in controllers.
- 2Register the MVC factory in services/provider.php.
Also known as
JModelLegacy::getInstance · JControllerLegacy::getInstance
Related issues
- Joomla 3 → 4MVC
getError() / setError() on models and tables
$model->setError() → Exceptions
- Joomla 5 → 6MVC
Table::getInstance()
JTable::getInstance('Content') → MVC / Table factory
- Joomla 3 → 4Joomla API
JGrid
JGrid → HTMLHelper grid / layouts — no 1:1 class
- Joomla 3 → 4MVC
assignRef() on views
$this->assignRef('item', $item) → $this->item = $item
- Joomla 3 → 4MVC
JTableObserver*
JTableObserverTags → Core plugins (tags, content history) — do not subclass observers
- Joomla 3 → 4MVC
FOF 2.x in core
FOFModel / FOFTable → FOF 3 / native Joomla MVC