fix(continuous-integration): correction php-cs-fixer
All checks were successful
Cadoles/nineskeletor/pipeline/pr-master This commit looks good

This commit is contained in:
2022-09-23 16:14:15 +02:00
parent 5f3cc51f5c
commit b78f54b76c
70 changed files with 5943 additions and 5549 deletions

View File

@ -1,16 +1,13 @@
<?php
namespace App\Command;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use App\Entity\Tallyday as Tallyday;
class CleanRegistrationCommand extends Command
{
@ -21,7 +18,7 @@ class CleanRegistrationCommand extends Command
private $rootlog;
private $byexec;
public function __construct(ContainerInterface $container,EntityManagerInterface $em)
public function __construct(ContainerInterface $container, EntityManagerInterface $em)
{
parent::__construct();
$this->container = $container;
@ -39,41 +36,49 @@ class CleanRegistrationCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->output = $output;
$this->filesystem = new Filesystem();
$this->rootlog = $this->container->get('kernel')->getLogDir()."/";
$this->output = $output;
$this->filesystem = new Filesystem();
$this->rootlog = $this->container->get('kernel')->getLogDir().'/';
$this->writelnred('');
$this->writelnred('== app:CleanRegistration');
$this->writelnred('== app:CleanRegistration');
$this->writelnred('==========================================================================================================');
$now=new \DateTime('now');
$now = new \DateTime('now');
$datas = $this->em
->createQueryBuilder()
->select('table')
->from('App\Entity\Registration','table')
->from('App\Entity\Registration', 'table')
->where('table.keyexpire<:now')
->setParameter("now",$now->format("Y-m-d H:i:s"))
->setParameter('now', $now->format('Y-m-d H:i:s'))
->getQuery()
->getResult();
foreach($datas as $data) {
$this->writeln('Inscription supprimée = '.$data->getkeyexpire()->format("Y-m-d H:i:s")." >> ".$data->getUsername());
foreach ($datas as $data) {
$this->writeln('Inscription supprimée = '.$data->getkeyexpire()->format('Y-m-d H:i:s').' >> '.$data->getUsername());
$this->em->remove($data);
$this->em->flush();
$this->em->flush();
}
$this->writeln('');
return Command::SUCCESS;
}
private function writelnred($string) {
private function writelnred($string)
{
$this->output->writeln('<fg=red>'.$string.'</>');
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
if($this->byexec) $this->filesystem->appendToFile($this->rootlog.'exec.log', $string."\n");
if ($this->byexec) {
$this->filesystem->appendToFile($this->rootlog.'exec.log', $string."\n");
}
}
private function writeln($string) {
private function writeln($string)
{
$this->output->writeln($string);
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
if($this->byexec) $this->filesystem->appendToFile($this->rootlog.'exec.log', $string."\n");
}
if ($this->byexec) {
$this->filesystem->appendToFile($this->rootlog.'exec.log', $string."\n");
}
}
}