FooLock2Command.php 613 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. use Symfony\Component\Console\Command\Command;
  3. use Symfony\Component\Console\Command\LockableTrait;
  4. use Symfony\Component\Console\Input\InputInterface;
  5. use Symfony\Component\Console\Output\OutputInterface;
  6. class FooLock2Command extends Command
  7. {
  8. use LockableTrait;
  9. protected function configure()
  10. {
  11. $this->setName('foo:lock2');
  12. }
  13. protected function execute(InputInterface $input, OutputInterface $output)
  14. {
  15. try {
  16. $this->lock();
  17. $this->lock();
  18. } catch (LogicException $e) {
  19. return 1;
  20. }
  21. return 2;
  22. }
  23. }