forked from massiveart/MassiveSearchBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInitCommand.php
48 lines (39 loc) · 1.17 KB
/
InitCommand.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/*
* This file is part of the MassiveSearchBundle
*
* (c) MASSIVE ART WebServices GmbH
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Massive\Bundle\SearchBundle\Command;
use Massive\Bundle\SearchBundle\Search\AdapterInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Initializes the search adapter.
*/
class InitCommand extends Command
{
protected static $defaultName = 'massive:search:init';
/**
* @var AdapterInterface
*/
private $adapter;
public function __construct(AdapterInterface $adapter)
{
parent::__construct(self::$defaultName);
$this->adapter = $adapter;
}
public function configure()
{
$this->setDescription('Initializes the search bundle');
$this->setHelp('This command will simply call the initialize method of the currently active search adapter.');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->adapter->initialize();
}
}