Commit 23e40074 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Suppression du cache affectation après le job de synchronisation qui...

Suppression du cache affectation après le job de synchronisation qui syncrhonise les affectations via Octopus
parent 48047c0d
Loading
Loading
Loading
Loading
Loading
+21 −1
Changes for module/Administration/src/Command/SynchronisationCommand.php: 21 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@

namespace Administration\Command;

use Application\Provider\Role\RoleProvider;
use Doctrine\Common\Cache\FilesystemCache;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -18,6 +20,9 @@ class SynchronisationCommand extends Command
{
    use ImportProcessusAwareTrait;

    protected FilesystemCache $doctrineCache;


    protected function configure(): void
    {
        $this->setName('synchronisation')
@@ -47,11 +52,26 @@ class SynchronisationCommand extends Command

            }
            $io->writeln("Lancement du job '" . $job . "'");
            $this->getProcessusImport()->syncJob($job);
            //$this->getProcessusImport()->syncJob($job);
            $io->writeln("Fin du job '" . $job . "'");
            //Suppresion du cache des affectations
            $io->writeln("Suppression du cache doctrine des affectations");

            $this->doctrineCache->delete(str_replace('\\', '_', RoleProvider::class) . '_affectations');

        }

        return Command::SUCCESS;
    }

    /**
     * @param FilesystemCache $doctrineCache
     */
    public function setDoctrineCache(FilesystemCache $doctrineCache)
    {
        $this->doctrineCache = $doctrineCache;

        return $this;
    }

}
 No newline at end of file
+2
Changes for module/Administration/src/Command/SynchronisationCommandFactory.php: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -23,8 +23,10 @@ class SynchronisationCommandFactory
     */
    public function __invoke(ContainerInterface $container, $requestedName, $options = null): SynchronisationCommand
    {
        $doctrineCache = $container->get('doctrine.cache.filesystem');
        $command = new SynchronisationCommand;
        $command->setProcessusImport($container->get(ImportProcessus::class));
        $command->setDoctrineCache($doctrineCache);

        /* Injectez vos dépendances ICI */