mirror of
https://github.com/verdigado/organization_folders.git
synced 2024-11-22 20:50:26 +01:00
35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace OCA\OrganizationFolders\Command\OrganizationFolder;
|
||
|
|
||
|
use OCP\DB\Exception;
|
||
|
use Symfony\Component\Console\Input\InputArgument;
|
||
|
use Symfony\Component\Console\Input\InputInterface;
|
||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||
|
|
||
|
use OCA\OrganizationFolders\Command\BaseCommand;
|
||
|
|
||
|
class GetOrganizationFolder extends BaseCommand {
|
||
|
protected function configure(): void {
|
||
|
$this
|
||
|
->setName('organization-folders:get')
|
||
|
->setDescription('Get organization folder by id')
|
||
|
->addArgument('id', null, InputArgument::REQUIRED, 'Id of the organization folder to get');
|
||
|
parent::configure();
|
||
|
}
|
||
|
|
||
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||
|
$id = (int)$input->getArgument('id');
|
||
|
|
||
|
try {
|
||
|
$organizationFolder = $this->organizationFolderService->find($id);
|
||
|
|
||
|
$this->writeTableInOutputFormat($input, $output, [$this->formatTableSerializable($organizationFolder)]);
|
||
|
return 0;
|
||
|
} catch (Exception $e) {
|
||
|
$output->writeln("<error>Exception \"{$e->getMessage()}\" at {$e->getFile()} line {$e->getLine()}</error>");
|
||
|
return 1;
|
||
|
}
|
||
|
}
|
||
|
}
|