ImportDoctrineCommand.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
  3. use Doctrine\DBAL\Tools\Console\Command\ImportCommand;
  4. use Symfony\Component\Console\Input\InputInterface;
  5. use Symfony\Component\Console\Input\InputOption;
  6. use Symfony\Component\Console\Output\OutputInterface;
  7. use function sprintf;
  8. use function trigger_error;
  9. use const E_USER_DEPRECATED;
  10. /**
  11. * Loads an SQL file and executes it.
  12. *
  13. * @deprecated Use a database client application instead.
  14. */
  15. class ImportDoctrineCommand extends ImportCommand
  16. {
  17. /**
  18. * {@inheritDoc}
  19. */
  20. protected function configure()
  21. {
  22. parent::configure();
  23. $this
  24. ->setName('doctrine:database:import')
  25. ->addOption('connection', null, InputOption::VALUE_OPTIONAL, 'The connection to use for this command');
  26. }
  27. /**
  28. * {@inheritDoc}
  29. */
  30. protected function execute(InputInterface $input, OutputInterface $output)
  31. {
  32. @trigger_error(sprintf('The "%s" (doctrine:database:import) command is deprecated, use a database client instead.', self::class), E_USER_DEPRECATED);
  33. DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection'));
  34. return parent::execute($input, $output);
  35. }
  36. }