|
1 <?php |
|
2 |
|
3 /* |
|
4 * This file is part of the Symfony package. |
|
5 * |
|
6 * (c) Fabien Potencier <fabien@symfony.com> |
|
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 namespace Symfony\Bundle\DoctrineBundle\Command\Proxy; |
|
13 |
|
14 use Symfony\Component\Console\Input\InputArgument; |
|
15 use Symfony\Component\Console\Input\InputOption; |
|
16 use Symfony\Component\Console\Input\InputInterface; |
|
17 use Symfony\Component\Console\Output\OutputInterface; |
|
18 use Symfony\Component\Console\Output\Output; |
|
19 use Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand; |
|
20 |
|
21 /** |
|
22 * Command to drop the database schema for a set of classes based on their mappings. |
|
23 * |
|
24 * @author Fabien Potencier <fabien@symfony.com> |
|
25 * @author Jonathan H. Wage <jonwage@gmail.com> |
|
26 */ |
|
27 class DropSchemaDoctrineCommand extends DropCommand |
|
28 { |
|
29 protected function configure() |
|
30 { |
|
31 parent::configure(); |
|
32 |
|
33 $this |
|
34 ->setName('doctrine:schema:drop') |
|
35 ->setDescription('Executes (or dumps) the SQL needed to drop the current database schema') |
|
36 ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command') |
|
37 ->setHelp(<<<EOT |
|
38 The <info>doctrine:schema:drop</info> command generates the SQL needed to |
|
39 drop the database schema of the default entity manager: |
|
40 |
|
41 <info>php app/console doctrine:schema:drop --dump-sql</info> |
|
42 |
|
43 Alternatively, you can execute the generated queries: |
|
44 |
|
45 <info>php app/console doctrine:schema:drop --force</info> |
|
46 |
|
47 You can also optionally specify the name of a entity manager to drop the |
|
48 schema for: |
|
49 |
|
50 <info>php app/console doctrine:schema:drop --em=default</info> |
|
51 EOT |
|
52 ); |
|
53 } |
|
54 |
|
55 protected function execute(InputInterface $input, OutputInterface $output) |
|
56 { |
|
57 DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); |
|
58 |
|
59 parent::execute($input, $output); |
|
60 } |
|
61 } |