From 26cfafcaadc962b96ba824318ec7cd9b4eae9dac Mon Sep 17 00:00:00 2001 From: Xbird Date: Wed, 14 Sep 2022 18:33:21 +0200 Subject: [PATCH] add objectId on watchdog --- src/Controller/AdminController.php | 14 ++++++++++++-- templates/_cells/historyDisplay.html.twig | 2 +- visionversion.json | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index 02d97ea..3b289d4 100644 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -679,14 +679,16 @@ class AdminController extends AbstractController } #[Route('/watchdog', name: 'watchdog')] + #[Route('/watchdog/view/{id}', name: 'watchdog_view')] #[Route('/watchdog/{type}', name: 'watchdog_type')] - #[Route('/watchdog/{type}/{action}', name: 'watchdog_type_action')] + #[Route('/watchdog/{type}/{action}', name: 'watchdog_type_action')] public function watchdog( PaginatorInterface $paginator, Request $Request, EntityManagerInterface $EntityManagerInterface, string $type = null, - string $action = null + string $action = null, + int $id = null ): Response { /** * @var LogEntryRepository $logEntryRepository @@ -704,6 +706,9 @@ class AdminController extends AbstractController ->from('Gedmo\Loggable\Entity\LogEntry', 'l') ->orderBy('l.loggedAt', 'DESC'); + + + if (null != $type) { $qb->where('l.objectClass = :type'); $qb->setParameter('type', 'App\Entity\\' . $type); @@ -718,6 +723,11 @@ class AdminController extends AbstractController } } + if(null != $id){ + $qb->where('l.objectId = :id'); + $qb->setParameter('id', $id); + } + $pagination = $paginator->paginate( $qb->getQuery()->getResult(), $Request->query->getInt('page', 1) diff --git a/templates/_cells/historyDisplay.html.twig b/templates/_cells/historyDisplay.html.twig index 4cdd176..de4df31 100644 --- a/templates/_cells/historyDisplay.html.twig +++ b/templates/_cells/historyDisplay.html.twig @@ -11,7 +11,7 @@ {% endif %}

{% if notype is not defined %} -

{{ i.objectClass }} (# {{ i.objectId }})

+

{{ i.objectClass }} (# {{ i.objectId }}) {% if is_granted('ROLE_ADMIN') %}{% endif %}

{% endif %}

{{ ('title_data_' ~ i.action)|trans }}

diff --git a/visionversion.json b/visionversion.json index 9379a31..ed58696 100644 --- a/visionversion.json +++ b/visionversion.json @@ -1,3 +1,3 @@ { - "version": "0.2.8" + "version": "0.2.9" }