CConsoleCommandEvent.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * CConsoleCommandEvent class file.
  4. *
  5. * @author Evgeny Blinov <e.a.blinov@gmail.com>
  6. * @link http://www.yiiframework.com/
  7. * @copyright 2008-2013 Yii Software LLC
  8. * @license http://www.yiiframework.com/license/
  9. */
  10. /**
  11. * CConsoleCommandEvent class.
  12. *
  13. * CConsoleCommandEvent represents the event parameters needed by events raised by a console command.
  14. *
  15. * @author Evgeny Blinov <e.a.blinov@gmail.com>
  16. * @package system.console
  17. * @since 1.1.11
  18. */
  19. class CConsoleCommandEvent extends CEvent
  20. {
  21. /**
  22. * @var string the action name
  23. */
  24. public $action;
  25. /**
  26. * @var boolean whether the action should be executed.
  27. * If this property is set true by the event handler, the console command action will quit after handling this event.
  28. * If false, which is the default, the normal execution cycles will continue, including performing the action and calling
  29. * {@link CConsoleCommand::afterAction}.
  30. */
  31. public $stopCommand=false;
  32. /**
  33. * @var integer exit code of application.
  34. * This property is available in {@link CConsoleCommand::onAfterAction} event and will be set to the exit code
  35. * returned by the console command action. You can set it to change application exit code.
  36. */
  37. public $exitCode;
  38. /**
  39. * Constructor.
  40. * @param mixed $sender sender of the event
  41. * @param string $params the parameters to be passed to the action method.
  42. * @param string $action the action name
  43. * @param integer $exitCode the application exit code
  44. */
  45. public function __construct($sender=null,$params=null,$action=null,$exitCode=0){
  46. parent::__construct($sender,$params);
  47. $this->action=$action;
  48. $this->exitCode=$exitCode;
  49. }
  50. }