EasyAdmin "PreviousNext" fatal error

Hi,

Omeka-S 4.2.0 / Common 3.4.78 / EasyAdmin 3.4.41

In the /admin/setting page > section Display > setting Elements to display in resources admin pages > option Buttons “Previous/Next”

If the option is checked, you get a fatal error when clicking on a media in the /admin/item/nnn page or in the /admin/media page:

Fatal error: Uncaught Error: Call to undefined method Doctrine\DBAL\Query\QueryBuilder::executeQuery() in /[my website path...]/omeka-s/modules/EasyAdmin/src/View/Helper/PreviousNextResourceTrait.php:435 Stack trace:
 #0 /[my website path...]/omeka-s/modules/EasyAdmin/src/View/Helper/PreviousNextResourceTrait.php(348): EasyAdmin\View\Helper\PreviousNext->getAdjacentMediaId(Object(Omeka\Api\Representation\MediaRepresentation), 'previous')
 #1 /[my website path...]/omeka-s/modules/EasyAdmin/src/View/Helper/PreviousNext.php(58): EasyAdmin\View\Helper\PreviousNext->previousMedia(Object(Omeka\Api\Representation\MediaRepresentation))
 #2 /[my website path...]/omeka-s/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php(467): EasyAdmin\View\Helper\PreviousNext->__invoke(Object(Omeka\Api\Representation\MediaRepresentation), Array)
 #3 /[my website path...]/omeka-s/modules/EasyAdmin/Module.php(928): Laminas\View\Renderer\PhpRenderer->__call('previousNext', Array)
 #4 /[my website path...]/omeka-s/modules/EasyAdmin/Module.php(676): EasyAdmin\Module->handleViewLayoutResourceShow(Object(Laminas\View\Renderer\PhpRenderer), 'media', 3721)
 #5 /[my website path...]/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(318): EasyAdmin\Module->handleViewLayoutResource(Object(Laminas\EventManager\Event))
 #6 /[my website path...]/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(168): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\EventManager\Event))
 #7 /[my website path...]/omeka-s/application/src/View/Helper/Trigger.php(60): Laminas\EventManager\EventManager->triggerEvent(Object(Laminas\EventManager\Event))
 #8 /[my website path...]/omeka-s/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php(467): Omeka\View\Helper\Trigger->__invoke('view.layout')
 #9 /[my website path...]/omeka-s/application/view/layout/layout-admin.phtml(25): Laminas\View\Renderer\PhpRenderer->__call('trigger', Array)
 #10 /[my website path...]/omeka-s/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php(585): include('/home/clients/6...')
 #11 /[my website path...]/omeka-s/vendor/laminas/laminas-view/src/View.php(202): Laminas\View\Renderer\PhpRenderer->render(NULL)
 #12 /[my website path...]/omeka-s/vendor/laminas/laminas-mvc/src/View/Http/DefaultRenderingStrategy.php(92): Laminas\View\View->render(Object(Laminas\View\Model\ViewModel))
 #13 /[my website path...]/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(318): Laminas\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Laminas\Mvc\MvcEvent))
 #14 /[my website path...]/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(168): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent))
 #15 /[my website path...]/omeka-s/vendor/laminas/laminas-mvc/src/View/Http/DefaultRenderingStrategy.php(110): Laminas\EventManager\EventManager->triggerEvent(Object(Laminas\Mvc\MvcEvent))
 #16 /[my website path...]/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(318): Laminas\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Laminas\Mvc\MvcEvent))
 #17 /[my website path...]/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(168): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent))
 #18 /[my website path...]/omeka-s/vendor/laminas/laminas-mvc/src/Application.php(354): Laminas\EventManager\EventManager->triggerEvent(Object(Laminas\Mvc\MvcEvent))
 #19 /[my website path...]/omeka-s/vendor/laminas/laminas-mvc/src/Application.php(335): Laminas\Mvc\Application->completeRequest(Object(Laminas\Mvc\MvcEvent))
 #20 /[my website path...]/omeka-s/index.php(26): Laminas\Mvc\Application->run()
 #21 {main} thrown in /[my website path...]/omeka-s/modules/EasyAdmin/src/View/Helper/PreviousNextResourceTrait.php on line 435

Temporary solution while waiting for an “official” one:

edit the file /omeka-s/modules/EasyAdmin/src/View/Helper/PreviousNextResourceTrait.php
go to to the line 435 and replace
$result = $qb->executeQuery()->fetchOne();
with
$result = $qb->execute()->fetchOne();

Thanks, it is fixed in version EasyAdmin 3.4.42.

Technically, in fact, i mix sometime doctrine 2 and doctrine 3 and dbal/orm/qb method names, but because there are a forward-compat names since doctrine 2.13, that omeka s uses since v4.0, i updated all my modules to use doctrine 3 method names in any case now, so it will simplify a future upgrade of omeka, that some people propose (see Use attributes instead of annotations for doctrine entities · Issue #2431 · omeka/omeka-s · GitHub or Removed zend framework bridge. by Daniel-KM · Pull Request #2270 · omeka/omeka-s · GitHub).