Completed
Pull Request — master (#397)
by
unknown
02:23
created

ReindexCommandController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 4 1
A execute() 0 7 1
1
<?php
2
3
/**
4
 * Reindex the event models.
5
 */
6
declare(strict_types=1);
7
8
namespace HDNET\Calendarize\Command;
9
10
use HDNET\Calendarize\Service\IndexerService;
11
use Symfony\Component\Console\Command\Command;
12
use Symfony\Component\Console\Input\InputInterface;
13
use Symfony\Component\Console\Output\OutputInterface;
14
use TYPO3\CMS\Core\Utility\GeneralUtility;
15
use TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException;
16
use TYPO3\CMS\Extbase\Mvc\Exception\InvalidExtensionNameException;
17
use TYPO3\CMS\Extbase\Object\Exception;
18
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException;
19
20
/**
21
 * Reindex the event models.
22
 */
23
class ReindexCommandController extends Command
24
{
25
26
    /**
27
     * @return void
28
     */
29
    public function configure()
30
    {
31
        $this->setDescription('Calendarize: Reindex all events');
32
    }
33
34
    /**
35
     *
36
     * @param InputInterface $input
37
     * @param OutputInterface $output
38
     * @return int
39
     * @throws InvalidConfigurationTypeException
40
     * @throws InvalidExtensionNameException
41
     * @throws Exception
42
     * @throws InvalidQueryException
43
     */
44
    protected function execute(InputInterface $input, OutputInterface $output)
45
    {
46
        $indexer = GeneralUtility::makeInstance(IndexerService::class);
47
        $indexer->reindexAll();
48
49
        return 0;
50
    }
51
}
52