CreateSchemaDoctrineODMCommand.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace Symfony\Bundle\DoctrineMongoDBBundle\Command;
  3. use Symfony\Component\Console\Input\InputArgument;
  4. use Symfony\Component\Console\Input\InputOption;
  5. use Symfony\Component\Console\Input\InputInterface;
  6. use Symfony\Component\Console\Output\OutputInterface;
  7. use Symfony\Component\Console\Output\Output;
  8. use Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\CreateCommand;
  9. /**
  10. * Command to create the database schema for a set of classes based on their mappings.
  11. *
  12. * @author Justin Hileman <justin@shopopensky.com>
  13. */
  14. class CreateSchemaDoctrineODMCommand extends CreateCommand
  15. {
  16. protected function configure()
  17. {
  18. parent::configure();
  19. $this
  20. ->setName('doctrine:odm:schema:create')
  21. ->addOption('dm', null, InputOption::PARAMETER_OPTIONAL, 'The document manager to use for this command.')
  22. ->setHelp(<<<EOT
  23. The <info>doctrine:odm:schema:create</info> command creates the default document manager's schema:
  24. <info>./symfony doctrine:odm:schema:create</info>
  25. You can also optionally specify the name of a document manager to create the schema for:
  26. <info>./symfony doctrine:odm:schema:create --dm=default</info>
  27. EOT
  28. );
  29. }
  30. protected function execute(InputInterface $input, OutputInterface $output)
  31. {
  32. DoctrineODMCommand::setApplicationDocumentManager($this->application, $input->getOption('dm'));
  33. parent::execute($input, $output);
  34. }
  35. }