47 lines
1.3KB

  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\base;
  8. /**
  9. * ActionEvent represents the event parameter used for an action event.
  10. *
  11. * By setting the [[isValid]] property, one may control whether to continue running the action.
  12. *
  13. * @author Qiang Xue <qiang.xue@gmail.com>
  14. * @since 2.0
  15. */
  16. class ActionEvent extends Event
  17. {
  18. /**
  19. * @var Action the action currently being executed
  20. */
  21. public $action;
  22. /**
  23. * @var mixed the action result. Event handlers may modify this property to change the action result.
  24. */
  25. public $result;
  26. /**
  27. * @var boolean whether to continue running the action. Event handlers of
  28. * [[Controller::EVENT_BEFORE_ACTION]] may set this property to decide whether
  29. * to continue running the current action.
  30. */
  31. public $isValid = true;
  32. /**
  33. * Constructor.
  34. * @param Action $action the action associated with this action event.
  35. * @param array $config name-value pairs that will be used to initialize the object properties
  36. */
  37. public function __construct($action, $config = [])
  38. {
  39. $this->action = $action;
  40. parent::__construct($config);
  41. }
  42. }