1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Sylius package. |
5
|
|
|
* |
6
|
|
|
* (c) Paweł Jędrzejewski |
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 Sylius\Bundle\ThemeBundle\Command; |
13
|
|
|
|
14
|
|
|
use Sylius\Bundle\ThemeBundle\Model\ThemeInterface; |
15
|
|
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
16
|
|
|
use Symfony\Component\Console\Helper\Table; |
17
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
18
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @author Kamil Kokot <[email protected]> |
22
|
|
|
*/ |
23
|
|
|
class ThemeDebugCommand extends ContainerAwareCommand |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* {@inheritdoc} |
27
|
|
|
*/ |
28
|
|
|
protected function configure() |
29
|
|
|
{ |
30
|
|
|
$this |
31
|
|
|
->setName('sylius:theme:debug') |
32
|
|
|
->setDescription('Shows list of detected themes.') |
33
|
|
|
; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* {@inheritdoc} |
38
|
|
|
*/ |
39
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
40
|
|
|
{ |
41
|
|
|
/** @var ThemeInterface[] $themes */ |
42
|
|
|
$themes = $this->getContainer()->get('sylius.theme.repository')->findAll(); |
43
|
|
|
|
44
|
|
|
if (0 === count($themes)) { |
45
|
|
|
$output->writeln('<error>There are no themes.</error>'); |
46
|
|
|
return; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
$output->writeln('<question>Succesfully loaded themes:</question>'); |
50
|
|
|
|
51
|
|
|
$table = new Table($output); |
52
|
|
|
$table->setHeaders(['Name', 'Slug', 'Path']); |
53
|
|
|
|
54
|
|
|
foreach ($themes as $theme) { |
55
|
|
|
$table->addRow([$theme->getName(), $theme->getSlug(), $theme->getPath()]); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
$table->setStyle('borderless'); |
59
|
|
|
$table->render(); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|