vendor/doctrine/phpcr-bundle/src/Command/WorkspaceQueryCommand.php line 15

  1. <?php
  2. namespace Doctrine\Bundle\PHPCRBundle\Command;
  3. use PHPCR\Util\Console\Command\WorkspaceQueryCommand as BaseWorkspaceQueryCommand;
  4. use Symfony\Component\Console\Input\InputInterface;
  5. use Symfony\Component\Console\Input\InputOption;
  6. use Symfony\Component\Console\Output\OutputInterface;
  7. /**
  8. * Wrapper to use this command in the symfony console with multiple sessions.
  9. *
  10. * @author Daniel Barsotti <daniel.barsotti@liip.ch>
  11. */
  12. class WorkspaceQueryCommand extends BaseWorkspaceQueryCommand
  13. {
  14. protected function configure(): void
  15. {
  16. parent::configure();
  17. $this
  18. ->setName('doctrine:phpcr:workspace:query')
  19. ->addOption('session', null, InputOption::VALUE_REQUIRED, 'The session to use for this command')
  20. ;
  21. }
  22. protected function execute(InputInterface $input, OutputInterface $output): int
  23. {
  24. DoctrineCommandHelper::setApplicationPHPCRSession(
  25. $this->getApplication(),
  26. $input->getOption('session')
  27. );
  28. return parent::execute($input, $output);
  29. }
  30. }