script qui valorise les niveau des users (ref #65)
This commit is contained in:
parent
70c1d6cd8c
commit
825947f4ae
|
@ -29,7 +29,7 @@ class ScriptCommand extends Command
|
|||
$this
|
||||
->setName('Core:Script')
|
||||
->setDescription('Lauch Script')
|
||||
->setHelp('Execeute some script : visibletrue / ')
|
||||
->setHelp('Execeute some script : visibletrue / setusersniveau')
|
||||
->addArgument('scriptname', InputArgument::OPTIONAL, 'scriptname')
|
||||
;
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ class ScriptCommand extends Command
|
|||
|
||||
switch($scriptname) {
|
||||
case "visibletrue": $this->visibletrue(); break;
|
||||
case "setusersniveau": $this->setusersniveau(); break;
|
||||
}
|
||||
|
||||
$this->writeln('');
|
||||
|
@ -70,6 +71,19 @@ class ScriptCommand extends Command
|
|||
}
|
||||
}
|
||||
|
||||
private function setusersniveau() {
|
||||
$users = $this->em->getRepository('CadolesCoreBundle:User')->findAll();
|
||||
foreach($users as $user) {
|
||||
$this->writeln($user->getUsername());
|
||||
|
||||
$user->setLabelniveau01($user->getNiveau01()->getLabel());
|
||||
$user->setLabelniveau02(($user->getNiveau02()?$user->getNiveau02()->getLabel():null));
|
||||
|
||||
$this->em->persist($user);
|
||||
$this->em->flush();
|
||||
}
|
||||
}
|
||||
|
||||
private function writelnred($string) {
|
||||
$this->output->writeln('<fg=red>'.$string.'</>');
|
||||
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
|
||||
|
|
Loading…
Reference in New Issue