CreateSchemaDoctrineCommand.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
  3. use Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand;
  4. use Symfony\Component\Console\Input\InputInterface;
  5. use Symfony\Component\Console\Input\InputOption;
  6. use Symfony\Component\Console\Output\OutputInterface;
  7. /**
  8. * Command to execute the SQL needed to generate the database schema for
  9. * a given entity manager.
  10. */
  11. class CreateSchemaDoctrineCommand extends CreateCommand
  12. {
  13. /**
  14. * {@inheritDoc}
  15. */
  16. protected function configure()
  17. {
  18. parent::configure();
  19. $this
  20. ->setName('doctrine:schema:create')
  21. ->setDescription('Executes (or dumps) the SQL needed to generate the database schema')
  22. ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
  23. }
  24. /**
  25. * {@inheritDoc}
  26. */
  27. protected function execute(InputInterface $input, OutputInterface $output)
  28. {
  29. DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
  30. return parent::execute($input, $output);
  31. }
  32. }