fix(joomla6): update webservices plugin for Joomla 6 typed event API
Joomla: Repo Health / Access control (push) Has been cancelled
Joomla: Update Server / Update updates.xml (push) Has been cancelled
Joomla: Repo Health / Release configuration (push) Has been cancelled
Joomla: Repo Health / Scripts governance (push) Has been cancelled
Joomla: Repo Health / Repository health (push) Has been cancelled

Joomla 6 changed SubscriberInterface event handlers to receive a typed
event object instead of pass-by-reference parameters. Update
onBeforeApiRoute() to accept BeforeApiRouteEvent and extract the
router via $event->getRouter().

Fixes #48

Authored-by: Moko Consulting
This commit is contained in:
Jonathan Miller
2026-05-26 13:42:32 -05:00
parent 08e2f171eb
commit 3f20ad985c
@@ -11,6 +11,7 @@ namespace Moko\Plugin\WebServices\MokoWaaS\Extension;
defined('_JEXEC') or die; defined('_JEXEC') or die;
use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Event\Application\BeforeApiRouteEvent;
use Joomla\CMS\Router\ApiRouter; use Joomla\CMS\Router\ApiRouter;
use Joomla\Event\SubscriberInterface; use Joomla\Event\SubscriberInterface;
@@ -36,14 +37,16 @@ final class MokoWaaSApi extends CMSPlugin implements SubscriberInterface
/** /**
* Register API routes for MokoWaaS. * Register API routes for MokoWaaS.
* *
* @param ApiRouter $router The API router * @param BeforeApiRouteEvent $event The API route event (Joomla 6 typed event)
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function onBeforeApiRoute(&$router): void public function onBeforeApiRoute(BeforeApiRouteEvent $event): void
{ {
$router = $event->getRouter();
$router->createCRUDRoutes( $router->createCRUDRoutes(
'v1/mokowaas/health', 'v1/mokowaas/health',
'health', 'health',