Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions config/routes/easyadmin.yaml

This file was deleted.

10 changes: 9 additions & 1 deletion src/Controller/Admin/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,23 @@
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;

class DashboardController extends AbstractDashboardController
{
public function __construct(
private readonly AdminUrlGenerator $adminUrlGenerator,
) {
}

#[Route('/admin', name: 'admin')]
public function index(): Response
{
return $this->redirectToRoute('admin_user_index');
return $this->redirect(
$this->adminUrlGenerator->setController(UserCrudController::class)->generateUrl()
);
}

public function configureDashboard(): Dashboard
Expand Down
15 changes: 9 additions & 6 deletions src/EventSubscriber/FeedbackCreatedListenerSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

namespace App\EventSubscriber;

use App\Controller\Admin\FeedbackCrudController;
use App\Entity\Feedback;
use Doctrine\Bundle\DoctrineBundle\Attribute\AsEntityListener;
use Doctrine\ORM\Events;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use Symfony\Component\Notifier\Notification\Notification;
use Symfony\Component\Notifier\NotifierInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

#[AsEntityListener(event: Events::postPersist, method: 'onFeedbackCreated', entity: Feedback::class)]
Expand All @@ -19,7 +20,7 @@
public function __construct(
private NotifierInterface $notifier,
private TranslatorInterface $translator,
private RouterInterface $router,
private AdminUrlGenerator $adminUrlGenerator,
) {
}

Expand All @@ -32,9 +33,11 @@ public function onFeedbackCreated(Feedback $feedback): void
'%account%' => $feedback->getSender()?->getUserIdentifier()
?? $this->translator->trans('notification.on-feedback-created.anonymous'),
'%subject%' => $feedback->getTitle(),
'%link%' => $this->router->generate('admin_feedback_detail', [
'entityId' => $feedback->getId(),
], UrlGeneratorInterface::ABSOLUTE_URL),
'%link%' => $this->adminUrlGenerator->unsetAll()
->setController(FeedbackCrudController::class)
->setAction(Action::DETAIL)
->setEntityId($feedback->getId())
->generateUrl(),
]);

$this->notifier->send((new Notification($notificationContent))->channels(['chat/linenotify']));
Expand Down
Loading