1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the SexyField package. |
5
|
|
|
* |
6
|
|
|
* (c) Dion Snoeijen <[email protected]> |
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
|
|
|
declare (strict_types = 1); |
13
|
|
|
|
14
|
|
|
namespace Tardigrades\Command; |
15
|
|
|
|
16
|
|
|
use Symfony\Component\Console\Helper\Table; |
17
|
|
|
use Symfony\Component\Console\Helper\TableCell; |
18
|
|
|
use Symfony\Component\Console\Helper\TableSeparator; |
19
|
|
|
use Symfony\Component\Console\Command\Command; |
20
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
21
|
|
|
use Tardigrades\Entity\FieldTypeInterface; |
22
|
|
|
|
23
|
|
|
abstract class FieldTypeCommand extends Command |
24
|
|
|
{ |
25
|
|
|
protected function renderTable(OutputInterface $output, array $fieldTypes, string $info) |
26
|
|
|
{ |
27
|
|
|
$table = new Table($output); |
28
|
|
|
|
29
|
|
|
$rows = []; |
30
|
|
|
/** @var FieldTypeInterface $fieldType */ |
31
|
|
|
foreach ($fieldTypes as $fieldType) { |
32
|
|
|
$rows[] = [ |
33
|
|
|
$fieldType->getId(), |
34
|
|
|
$fieldType->getType(), |
35
|
|
|
$fieldType->getFullyQualifiedClassName(), |
36
|
|
|
$fieldType->getCreated()->format('D-m-y'), |
37
|
|
|
$fieldType->getUpdated()->format('D-m-y'), |
38
|
|
|
]; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
$rows[] = new TableSeparator(); |
42
|
|
|
$rows[] = [ |
43
|
|
|
new TableCell('<info>' . $info . '</info>', array('colspan' => 5)) |
44
|
|
|
]; |
45
|
|
|
|
46
|
|
|
$table |
47
|
|
|
->setHeaders(['#id', 'type', 'namespace', 'created', 'updated']) |
48
|
|
|
->setRows($rows) |
49
|
|
|
; |
50
|
|
|
$table->render(); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|