add objectId on watchdog

This commit is contained in:
Xbird
2022-09-14 18:33:21 +02:00
parent 7f9d65d89c
commit 26cfafcaad
3 changed files with 14 additions and 4 deletions

View File

@@ -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)

View File

@@ -11,7 +11,7 @@
{% endif %}
</p>
{% if notype is not defined %}
<p>{{ i.objectClass }} (# {{ i.objectId }})</p>
<p>{{ i.objectClass }} (# {{ i.objectId }}) {% if is_granted('ROLE_ADMIN') %}<a href="{{ path('admin_watchdog_view', {'id': i.objectId}) }}" class="btn btn-warning btn-sm" data-bs-toggle="tooltip" data-placement="top" title="{% trans %}tooltip_directory_history{% endtrans %} (Admin)"><i class="fas fa-clock"></i></a>{% endif %}</p>
{% endif %}
<p>{{ ('title_data_' ~ i.action)|trans }}</p>
<div class="table-responsive">

View File

@@ -1,3 +1,3 @@
{
"version": "0.2.8"
"version": "0.2.9"
}