fix: route EbayAspectImportController redirects through AdminUrlGenerator
Plain redirectToRoute() bypasses EasyAdmin's AdminRouterSubscriber, so the admin context (ea.i18n etc.) was never set and the EasyAdmin layout threw "Impossible to access i18n on null". Using AdminUrlGenerator wraps the redirect URL in the EasyAdmin routing layer, keeping context alive. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
53e2d36574
commit
0fdb4979c1
1 changed files with 5 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ use App\Domain\Article\AttributeType;
|
|||
use App\Domain\Article\Repository\ArticleTypeRepositoryInterface;
|
||||
use App\Infrastructure\Channel\Ebay\EbayTaxonomyService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
|
@ -25,6 +26,7 @@ final class EbayAspectImportController extends AbstractController
|
|||
private readonly ArticleTypeRepositoryInterface $articleTypeRepo,
|
||||
private readonly EbayTaxonomyService $taxonomy,
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly AdminUrlGenerator $adminUrlGenerator,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +108,9 @@ final class EbayAspectImportController extends AbstractController
|
|||
$this->em->flush();
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('admin_ebay_aspect_import', ['id' => $articleType->getId()->toRfc4122()]);
|
||||
return $this->redirect(
|
||||
$this->adminUrlGenerator->setRoute('admin_ebay_aspect_import', ['id' => $articleType->getId()->toRfc4122()])->generateUrl()
|
||||
);
|
||||
}
|
||||
|
||||
private function handleImport(Request $request, ArticleType $articleType): Response
|
||||
|
|
|
|||
Loading…
Reference in a new issue