<?php declare(strict_types=1);

namespace App\Engine\Cache;

final class CacheInvalidatorController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
{

    public function clearAll(
        \Symfony\Component\Routing\RouterInterface         $router,
        \Symfony\Contracts\Translation\TranslatorInterface $translator,
    ): \Symfony\Component\HttpFoundation\RedirectResponse {
        exec('cd ../bin/ && ./console cache:clear');
        $this->addFlash("success", $translator->trans("admin.cache.cleared-successfully"));

        return new \Symfony\Component\HttpFoundation\RedirectResponse(
            url: $router->generate("AdminDashboard"),
        );
    }

}