]> Raphaël G. Git Repositories - airbundle/blob - Command/RekeyCommand.php
Reorder constructor arguments
[airbundle] / Command / RekeyCommand.php
1 <?php declare(strict_types=1);
2
3 /*
4 * This file is part of the Rapsys AirBundle package.
5 *
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Rapsys\AirBundle\Command;
13
14 use Doctrine\Bundle\DoctrineBundle\Command\DoctrineCommand;
15 use Symfony\Component\Console\Input\InputInterface;
16 use Symfony\Component\Console\Output\OutputInterface;
17
18 use Rapsys\AirBundle\Command;
19 use Rapsys\AirBundle\Entity\Session;
20
21 /**
22 * {@inheritdoc}
23 */
24 class RekeyCommand extends DoctrineCommand {
25 /**
26 * Configure attribute command
27 */
28 protected function configure() {
29 //Configure the class
30 $this
31 //Set name
32 ->setName('rapsysair:rekey')
33 //Set description shown with bin/console list
34 ->setDescription('Rekey sessions')
35 //Set description shown with bin/console --help airlibre:attribute
36 ->setHelp('This command rekey sessions in chronological order');
37 }
38
39 /**
40 * Process the attribution
41 */
42 protected function execute(InputInterface $input, OutputInterface $output): int {
43 //Fetch doctrine
44 $doctrine = $this->getDoctrine();
45
46 //Rekey sessions
47 if (!$doctrine->getRepository(Session::class)->rekey()) {
48 //Return failure
49 return self::FAILURE;
50 }
51
52 //Return success
53 return self::SUCCESS;
54 }
55 }