@@ -15,66 +15,66 @@ |
||
15 | 15 | */ |
16 | 16 | class ListPatchesCommand extends Command |
17 | 17 | { |
18 | - /** |
|
19 | - * @var PatchService |
|
20 | - */ |
|
21 | - private $patchService; |
|
18 | + /** |
|
19 | + * @var PatchService |
|
20 | + */ |
|
21 | + private $patchService; |
|
22 | 22 | |
23 | - public function __construct(PatchService $patchService) |
|
24 | - { |
|
25 | - parent::__construct(); |
|
26 | - $this->patchService = $patchService; |
|
27 | - } |
|
23 | + public function __construct(PatchService $patchService) |
|
24 | + { |
|
25 | + parent::__construct(); |
|
26 | + $this->patchService = $patchService; |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * {@inheritdoc} |
|
32 | - */ |
|
33 | - protected function configure() |
|
34 | - { |
|
35 | - $this |
|
36 | - ->setName('patches:list') |
|
37 | - ->setDescription('List all the patches.') |
|
38 | - ->setDefinition(array( |
|
30 | + /** |
|
31 | + * {@inheritdoc} |
|
32 | + */ |
|
33 | + protected function configure() |
|
34 | + { |
|
35 | + $this |
|
36 | + ->setName('patches:list') |
|
37 | + ->setDescription('List all the patches.') |
|
38 | + ->setDefinition(array( |
|
39 | 39 | |
40 | - )) |
|
41 | - ->setHelp(<<<EOT |
|
40 | + )) |
|
41 | + ->setHelp(<<<EOT |
|
42 | 42 | List all patches declared in Mouf patch service. |
43 | 43 | |
44 | 44 | The command will display the status of each patch, i.e. whether it has been applied or skipped or is waiting to be applied. |
45 | 45 | EOT |
46 | - ); |
|
47 | - } |
|
46 | + ); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * {@inheritdoc} |
|
51 | - */ |
|
52 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
53 | - { |
|
54 | - $patches = $this->patchService->getView(); |
|
49 | + /** |
|
50 | + * {@inheritdoc} |
|
51 | + */ |
|
52 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
53 | + { |
|
54 | + $patches = $this->patchService->getView(); |
|
55 | 55 | |
56 | - $rows = array_map(function($row) { |
|
57 | - return [ $row['uniqueName'], $this->renderStatus($row['status']), $row['patch_type'] ?: '(default)' ]; |
|
58 | - }, $patches); |
|
56 | + $rows = array_map(function($row) { |
|
57 | + return [ $row['uniqueName'], $this->renderStatus($row['status']), $row['patch_type'] ?: '(default)' ]; |
|
58 | + }, $patches); |
|
59 | 59 | |
60 | - $table = new Table($output); |
|
61 | - $table |
|
62 | - ->setHeaders(array('Patch', 'Status', 'Type')) |
|
63 | - ->setRows($rows) |
|
64 | - ; |
|
65 | - $table->render(); |
|
66 | - } |
|
60 | + $table = new Table($output); |
|
61 | + $table |
|
62 | + ->setHeaders(array('Patch', 'Status', 'Type')) |
|
63 | + ->setRows($rows) |
|
64 | + ; |
|
65 | + $table->render(); |
|
66 | + } |
|
67 | 67 | |
68 | - private function renderStatus($status) { |
|
69 | - $map = [ |
|
70 | - PatchInterface::STATUS_APPLIED => "<info>Applied</info>", |
|
71 | - PatchInterface::STATUS_SKIPPED => "<comment>Skipped</comment>", |
|
72 | - PatchInterface::STATUS_AWAITING => "Awaiting", |
|
73 | - PatchInterface::STATUS_ERROR => "<error>Skipped</error>", |
|
74 | - ]; |
|
75 | - if (!isset($map[$status])) { |
|
76 | - throw new \Exception('Unexpected status "'.$map[$status].'"'); |
|
77 | - } |
|
78 | - return $map[$status]; |
|
79 | - } |
|
68 | + private function renderStatus($status) { |
|
69 | + $map = [ |
|
70 | + PatchInterface::STATUS_APPLIED => "<info>Applied</info>", |
|
71 | + PatchInterface::STATUS_SKIPPED => "<comment>Skipped</comment>", |
|
72 | + PatchInterface::STATUS_AWAITING => "Awaiting", |
|
73 | + PatchInterface::STATUS_ERROR => "<error>Skipped</error>", |
|
74 | + ]; |
|
75 | + if (!isset($map[$status])) { |
|
76 | + throw new \Exception('Unexpected status "'.$map[$status].'"'); |
|
77 | + } |
|
78 | + return $map[$status]; |
|
79 | + } |
|
80 | 80 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | $patches = $this->patchService->getView(); |
55 | 55 | |
56 | 56 | $rows = array_map(function($row) { |
57 | - return [ $row['uniqueName'], $this->renderStatus($row['status']), $row['patch_type'] ?: '(default)' ]; |
|
57 | + return [$row['uniqueName'], $this->renderStatus($row['status']), $row['patch_type'] ?: '(default)']; |
|
58 | 58 | }, $patches); |
59 | 59 | |
60 | 60 | $table = new Table($output); |
@@ -19,53 +19,53 @@ |
||
19 | 19 | |
20 | 20 | class PatchInstaller2 implements PackageInstallerInterface |
21 | 21 | { |
22 | - /** |
|
23 | - * (non-PHPdoc) |
|
24 | - * @see \Mouf\Installer\PackageInstallerInterface::install() |
|
25 | - * @param MoufManager $moufManager |
|
26 | - * @throws \Mouf\MoufException |
|
27 | - */ |
|
28 | - public static function install(MoufManager $moufManager) |
|
29 | - { |
|
30 | - // Let's create the instance. |
|
31 | - $patchDefaultType = InstallUtils::getOrCreateInstance('patch.default_type', PatchType::class, $moufManager); |
|
32 | - $patchDefaultType->getConstructorArgumentProperty('name')->setValue(''); |
|
33 | - $patchDefaultType->getConstructorArgumentProperty('description')->setValue('Patches that should be always applied should have this type. Typically, use this type for DDL changes or reference data insertion.'); |
|
22 | + /** |
|
23 | + * (non-PHPdoc) |
|
24 | + * @see \Mouf\Installer\PackageInstallerInterface::install() |
|
25 | + * @param MoufManager $moufManager |
|
26 | + * @throws \Mouf\MoufException |
|
27 | + */ |
|
28 | + public static function install(MoufManager $moufManager) |
|
29 | + { |
|
30 | + // Let's create the instance. |
|
31 | + $patchDefaultType = InstallUtils::getOrCreateInstance('patch.default_type', PatchType::class, $moufManager); |
|
32 | + $patchDefaultType->getConstructorArgumentProperty('name')->setValue(''); |
|
33 | + $patchDefaultType->getConstructorArgumentProperty('description')->setValue('Patches that should be always applied should have this type. Typically, use this type for DDL changes or reference data insertion.'); |
|
34 | 34 | |
35 | - $patchTestDataType = InstallUtils::getOrCreateInstance('patch.testdata_type', PatchType::class, $moufManager); |
|
36 | - $patchTestDataType->getConstructorArgumentProperty('name')->setValue('test_data'); |
|
37 | - $patchTestDataType->getConstructorArgumentProperty('description')->setValue('Use this type to mark patches that contain test data that should only be used in staging environment.'); |
|
35 | + $patchTestDataType = InstallUtils::getOrCreateInstance('patch.testdata_type', PatchType::class, $moufManager); |
|
36 | + $patchTestDataType->getConstructorArgumentProperty('name')->setValue('test_data'); |
|
37 | + $patchTestDataType->getConstructorArgumentProperty('description')->setValue('Use this type to mark patches that contain test data that should only be used in staging environment.'); |
|
38 | 38 | |
39 | - $patchService = InstallUtils::getOrCreateInstance('patchService', PatchService::class, $moufManager); |
|
39 | + $patchService = InstallUtils::getOrCreateInstance('patchService', PatchService::class, $moufManager); |
|
40 | 40 | |
41 | - if (empty($patchService->getConstructorArgumentProperty('types')->getValue())) { |
|
42 | - $patchService->getConstructorArgumentProperty('types')->setValue([ $patchDefaultType, $patchTestDataType ]); |
|
43 | - } |
|
41 | + if (empty($patchService->getConstructorArgumentProperty('types')->getValue())) { |
|
42 | + $patchService->getConstructorArgumentProperty('types')->setValue([ $patchDefaultType, $patchTestDataType ]); |
|
43 | + } |
|
44 | 44 | |
45 | - $consoleUtils = new ConsoleUtils($moufManager); |
|
45 | + $consoleUtils = new ConsoleUtils($moufManager); |
|
46 | 46 | |
47 | - $listPatchesCommand = $moufManager->createInstance(ListPatchesCommand::class); |
|
48 | - $listPatchesCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
49 | - $consoleUtils->registerCommand($listPatchesCommand); |
|
47 | + $listPatchesCommand = $moufManager->createInstance(ListPatchesCommand::class); |
|
48 | + $listPatchesCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
49 | + $consoleUtils->registerCommand($listPatchesCommand); |
|
50 | 50 | |
51 | - $applyAllPatchesCommand = $moufManager->createInstance(ApplyAllPatchesCommand::class); |
|
52 | - $applyAllPatchesCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
53 | - $consoleUtils->registerCommand($applyAllPatchesCommand); |
|
51 | + $applyAllPatchesCommand = $moufManager->createInstance(ApplyAllPatchesCommand::class); |
|
52 | + $applyAllPatchesCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
53 | + $consoleUtils->registerCommand($applyAllPatchesCommand); |
|
54 | 54 | |
55 | - $applyPatchCommand = $moufManager->createInstance(ApplyPatchCommand::class); |
|
56 | - $applyPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
57 | - $consoleUtils->registerCommand($applyPatchCommand); |
|
55 | + $applyPatchCommand = $moufManager->createInstance(ApplyPatchCommand::class); |
|
56 | + $applyPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
57 | + $consoleUtils->registerCommand($applyPatchCommand); |
|
58 | 58 | |
59 | - $skipPatchCommand = $moufManager->createInstance(SkipPatchCommand::class); |
|
60 | - $skipPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
61 | - $consoleUtils->registerCommand($skipPatchCommand); |
|
59 | + $skipPatchCommand = $moufManager->createInstance(SkipPatchCommand::class); |
|
60 | + $skipPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
61 | + $consoleUtils->registerCommand($skipPatchCommand); |
|
62 | 62 | |
63 | - $revertPatchCommand = $moufManager->createInstance(RevertPatchCommand::class); |
|
64 | - $revertPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
65 | - $consoleUtils->registerCommand($revertPatchCommand); |
|
63 | + $revertPatchCommand = $moufManager->createInstance(RevertPatchCommand::class); |
|
64 | + $revertPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
65 | + $consoleUtils->registerCommand($revertPatchCommand); |
|
66 | 66 | |
67 | 67 | |
68 | - // Let's rewrite the MoufComponents.php file to save the component |
|
69 | - $moufManager->rewriteMouf(); |
|
70 | - } |
|
68 | + // Let's rewrite the MoufComponents.php file to save the component |
|
69 | + $moufManager->rewriteMouf(); |
|
70 | + } |
|
71 | 71 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | $patchService = InstallUtils::getOrCreateInstance('patchService', PatchService::class, $moufManager); |
40 | 40 | |
41 | 41 | if (empty($patchService->getConstructorArgumentProperty('types')->getValue())) { |
42 | - $patchService->getConstructorArgumentProperty('types')->setValue([ $patchDefaultType, $patchTestDataType ]); |
|
42 | + $patchService->getConstructorArgumentProperty('types')->setValue([$patchDefaultType, $patchTestDataType]); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $consoleUtils = new ConsoleUtils($moufManager); |