mirror of
https://github.com/verdigado/organization_folders.git
synced 2024-11-23 21:20:28 +01:00
added occ command to remove resource
This commit is contained in:
parent
fe50f71d6b
commit
4dad10d23f
2 changed files with 35 additions and 0 deletions
|
@ -28,6 +28,7 @@
|
||||||
<command>OCA\OrganizationFolders\Command\Resource\CreateResource</command>
|
<command>OCA\OrganizationFolders\Command\Resource\CreateResource</command>
|
||||||
<command>OCA\OrganizationFolders\Command\Resource\ListResources</command>
|
<command>OCA\OrganizationFolders\Command\Resource\ListResources</command>
|
||||||
<command>OCA\OrganizationFolders\Command\Resource\UpdateResource</command>
|
<command>OCA\OrganizationFolders\Command\Resource\UpdateResource</command>
|
||||||
|
<command>OCA\OrganizationFolders\Command\Resource\RemoveResource</command>
|
||||||
<command>OCA\OrganizationFolders\Command\ResourceMember\CreateResourceMember</command>
|
<command>OCA\OrganizationFolders\Command\ResourceMember\CreateResourceMember</command>
|
||||||
<command>OCA\OrganizationFolders\Command\ResourceMember\ListResourceMembers</command>
|
<command>OCA\OrganizationFolders\Command\ResourceMember\ListResourceMembers</command>
|
||||||
<command>OCA\OrganizationFolders\Command\ResourceMember\RemoveResourceMember</command>
|
<command>OCA\OrganizationFolders\Command\ResourceMember\RemoveResourceMember</command>
|
||||||
|
|
34
lib/Command/Resource/RemoveResource.php
Normal file
34
lib/Command/Resource/RemoveResource.php
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OCA\OrganizationFolders\Command\Resource;
|
||||||
|
|
||||||
|
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 RemoveResource extends BaseCommand {
|
||||||
|
protected function configure(): void {
|
||||||
|
$this
|
||||||
|
->setName('organization-folders:remove-resource')
|
||||||
|
->setDescription('Remove a resource')
|
||||||
|
->addArgument('id', InputArgument::REQUIRED, 'Id of the resource');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
|
$id = (int)$input->getArgument('id');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->resourceService->deleteById($id);
|
||||||
|
|
||||||
|
$output->writeln("done");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$output->writeln("<error>Exception \"{$e->getMessage()}\" at {$e->getFile()} line {$e->getLine()}</error>");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue