FooLockCommand.php 562 B

123456789101112131415161718192021222324252627
  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 FooLockCommand extends Command
  7. {
  8. use LockableTrait;
  9. protected function configure()
  10. {
  11. $this->setName('foo:lock');
  12. }
  13. protected function execute(InputInterface $input, OutputInterface $output)
  14. {
  15. if (!$this->lock()) {
  16. return 1;
  17. }
  18. $this->release();
  19. return 2;
  20. }
  21. }