JDISPATCHER-CLASS-001
JDispatcher::getInstance()
JDispatcher / JEventDispatcher
The old dispatcher was removed in Joomla 4. Plugins should subscribe to events, not trigger JDispatcher.
JDispatcher::getInstance() → Event dispatcher + SubscriberInterface
What you will see
- Class "JDispatcher" not found
- Class "JEventDispatcher" not found
Symptoms people search
plugin events never fire · trigger() fatal
Replace this code
Swap JDispatcher::getInstance() for Event dispatcher + SubscriberInterface.
Joomla 3
Remove or stop calling this
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onFoo', $args);Joomla 4 / 6
Use this instead
$dispatcher = Factory::getApplication()->getDispatcher();
// Plugins should implement SubscriberInterfaceHow to fix it
- 1Stop calling JDispatcher::getInstance().
- 2For plugins, implement SubscriberInterface::getSubscribedEvents().
- 3To dispatch, use the application dispatcher and Event classes.
Also known as
JDispatcher · JEventDispatcher · trigger(
There is no 1:1 swap for this one. The architecture changed. If you cannot rewrite it, Infyways can.
Related issues
- Joomla 3 → 4PHP
DS path constant
DS → DIRECTORY_SEPARATOR or /
- Joomla 4 → 5PHP
Dynamic PHP properties (PHP 8.2+)
$this->foo = 1 on an untyped class → Declare the property or use AllowDynamicProperties
- Joomla 5 → 6Events / plugins
JPlugin onX methods vs SubscriberInterface
function onContentPrepare(...) → CMSPlugin + SubscriberInterface::getSubscribedEvents()
- Joomla 3 → 4Manifest / installer
Joomla 1.5 plugin folder / discover install
plugins/content/foo.php (1.5 layout) → plugins/content/foo/foo.php + foo.xml (1.6+ layout)
- Joomla 3 → 4SQL / schema
DROP TABLE without IF EXISTS
DROP TABLE `#__lms_old`; → DROP TABLE IF EXISTS `#__lms_old`;
- Joomla 3 → 4Events / plugins
onAfterRender HTML string hacks
onAfterRender() { $body = JResponse::getBody(); } → Document events / WebAssetManager