for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Facile\MongoDbBundle\Commands;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class DropDatabaseCommand.
*/
class DropDatabaseCommand extends AbstractClientCommand
{
* {@inheritdoc}
protected function configure()
parent::configure();
$this
->setName('mongodb:database:drop')
->setDescription('Drops a database')
->addArgument('database', InputArgument::REQUIRED, 'The database to drop')
->addOption('if-exists', null, InputOption::VALUE_NONE, 'Don\'t trigger an error, when the database do not exists')
;
}
protected function execute(InputInterface $input, OutputInterface $output)
$databaseName = $input->getArgument('database');
$this->client->dropDatabase($databaseName);
$this->io->writeln(sprintf('Database %s dropped', $databaseName));