diff --git a/core/Cache/SymfonyCacheManager.php b/core/Cache/SymfonyCacheManager.php index da72bad..4fb7fe2 100644 --- a/core/Cache/SymfonyCacheManager.php +++ b/core/Cache/SymfonyCacheManager.php @@ -40,12 +40,21 @@ class SymfonyCacheManager { $application = new Application($this->kernel); $application->setAutoExit(false); + $output = new BufferedOutput(); $input = new ArrayInput([ 'command' => 'cache:clear', + '-e' => $this->kernel->getEnvironment(), + '--no-warmup' => null, + ]); + + $application->run($input, $output); + + $input = new ArrayInput([ + 'command' => 'cache:warmup', + '-e' => $this->kernel->getEnvironment(), ]); - $output = new BufferedOutput(); $application->run($input, $output); } } diff --git a/core/Controller/Account/AccountAdminController.php b/core/Controller/Account/AccountAdminController.php index 4a3ad04..5ea4b6e 100644 --- a/core/Controller/Account/AccountAdminController.php +++ b/core/Controller/Account/AccountAdminController.php @@ -4,7 +4,7 @@ namespace App\Core\Controller\Account; use App\Core\Controller\Admin\AdminController; use App\Core\Manager\EntityManager; -use App\Core\Repository\UserRepository; +use App\Repository\UserRepository; use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface; use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface as TotpAuthenticatorInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/core/Controller/Site/PageController.php b/core/Controller/Site/PageController.php index bf08f41..644fd83 100644 --- a/core/Controller/Site/PageController.php +++ b/core/Controller/Site/PageController.php @@ -19,13 +19,13 @@ class PageController extends AbstractController $this->siteStore = $siteStore; } - public function show(Request $request, SiteRequest $siteRequest): Response + public function show(): Response { - if (!$siteRequest->getPage()) { + if (!$this->siteRequest->getPage()) { throw $this->createNotFoundException(); } - return $this->defaultRender($siteRequest->getPage()->getTemplate()); + return $this->defaultRender($this->siteRequest->getPage()->getTemplate()); } protected function defaultRender(string $view, array $parameters = [], Response $response = null): Response diff --git a/core/EventSuscriber/EntityManagerEventSubscriber.php b/core/EventSuscriber/EntityManagerEventSubscriber.php index 586fbf4..8d663dc 100644 --- a/core/EventSuscriber/EntityManagerEventSubscriber.php +++ b/core/EventSuscriber/EntityManagerEventSubscriber.php @@ -12,15 +12,17 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; */ abstract class EntityManagerEventSubscriber implements EventSubscriberInterface { + static protected int $priority = 0; + public static function getSubscribedEvents() { return [ - EntityManagerEvent::CREATE_EVENT => 'onCreate', - EntityManagerEvent::UPDATE_EVENT => 'onUpdate', - EntityManagerEvent::DELETE_EVENT => 'onDelete', - EntityManagerEvent::PRE_CREATE_EVENT => 'onPreCreate', - EntityManagerEvent::PRE_UPDATE_EVENT => 'onPreUpdate', - EntityManagerEvent::PRE_DELETE_EVENT => 'onPreDelete', + EntityManagerEvent::CREATE_EVENT => ['onCreate', self::$priority], + EntityManagerEvent::UPDATE_EVENT => ['onUpdate', self::$priority], + EntityManagerEvent::DELETE_EVENT => ['onDelete', self::$priority], + EntityManagerEvent::PRE_CREATE_EVENT => ['onPreCreate', self::$priority], + EntityManagerEvent::PRE_UPDATE_EVENT => ['onPreUpdate', self::$priority], + EntityManagerEvent::PRE_DELETE_EVENT => ['onPreDelete', self::$priority], ]; } diff --git a/core/EventSuscriber/Site/MenuEventSubscriber.php b/core/EventSuscriber/Site/MenuEventSubscriber.php index 72335c3..56ab531 100644 --- a/core/EventSuscriber/Site/MenuEventSubscriber.php +++ b/core/EventSuscriber/Site/MenuEventSubscriber.php @@ -88,7 +88,7 @@ class MenuEventSubscriber extends EntityManagerEventSubscriber $this->nodeRepository->persistAsFirstChild($childNode, $rootNode); - $this->cacheManager->cleanAll(); + $this->cacheManager->cleanRouting(); } public function onUpdate(EntityManagerEvent $event) diff --git a/core/EventSuscriber/Site/SiteEventSubscriber.php b/core/EventSuscriber/Site/SiteEventSubscriber.php index 6c6a8c3..db9d5e6 100644 --- a/core/EventSuscriber/Site/SiteEventSubscriber.php +++ b/core/EventSuscriber/Site/SiteEventSubscriber.php @@ -39,11 +39,7 @@ class SiteEventSubscriber extends EntityManagerEventSubscriber return; } - if ($event->getEntity() instanceof Node) { - $this->cacheManager->cleanRouting(); - } else { - $this->cacheManager->cleanAll(); - } + $this->cacheManager->cleanRouting(); } public function onCreate(EntityManagerEvent $event) diff --git a/core/Repository/RepositoryQuery.php b/core/Repository/RepositoryQuery.php index 27addf9..05a4a86 100644 --- a/core/Repository/RepositoryQuery.php +++ b/core/Repository/RepositoryQuery.php @@ -28,28 +28,8 @@ abstract class RepositoryQuery public function __call(string $name, $params): self { - $fn = function (&$data) { - if (is_string($data)) { - $words = explode(' ', $data); - - foreach ($words as $k => $v) { - if (isset($v[0]) && '.' === $v[0]) { - $words[$k] = $this->id.$v; - } - } - - $data = implode(' ', $words); - } elseif (is_array($data)) { - foreach ($data as $k => $v) { - $fn($data[$k]); - } - } - - return $data; - }; - foreach ($params as $key => $value) { - $fn($params[$key]); + $this->populateDqlId($params[$key]); } call_user_func_array([$this->query, $name], $params); @@ -93,4 +73,25 @@ abstract class RepositoryQuery { return $this->repository; } + + protected function populateDqlId(&$data) + { + if (is_string($data)) { + $words = explode(' ', $data); + + foreach ($words as $k => $v) { + if (isset($v[0]) && '.' === $v[0]) { + $words[$k] = $this->id.$v; + } + } + + $data = implode(' ', $words); + } elseif (is_array($data)) { + foreach ($data as $k => $v) { + $this->populateDqlId($data[$k]); + } + } + + return $data; + } } diff --git a/core/Resources/translations/messages.fr.yaml b/core/Resources/translations/messages.fr.yaml index bc61624..61b0f18 100644 --- a/core/Resources/translations/messages.fr.yaml +++ b/core/Resources/translations/messages.fr.yaml @@ -121,3 +121,8 @@ "Show the login page": "Afficher la page de connexion" "A password reset request has been made. If you are the source of this request, click on the link below or copy and paste the address if the link does not work.": "Une demande de réinitialisation de mot de passe a été réalisée. Si vous êtes à l'origine de cette demande, cliquer sur le lien ci-dessous ou copier et coller l'adresse si le lien ne fonctionne pas." "Edit the routing": "Éditez le routage" +"Name": "Nom" +"Authentication": "Authentification" +"Anyway": "Peu importe" +"Yes": "Oui" +"No": "Non" diff --git a/core/Resources/views/auth/2fa.html.twig b/core/Resources/views/auth/2fa.html.twig index 60fea25..d6d2768 100644 --- a/core/Resources/views/auth/2fa.html.twig +++ b/core/Resources/views/auth/2fa.html.twig @@ -4,7 +4,7 @@
{{ include('@Core/admin/module/metas.html.twig') }} -