Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding full-featured events CConsoleCommand::onBeforeAction & CConsol…
…eCommand::onAfterAction
- Loading branch information
Showing
4 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* CConsoleCommandEvent class file. | ||
* | ||
* @author Evgeny Blinov <e.a.blinov@gmail.com> | ||
* @link http://www.yiiframework.com/ | ||
* @copyright Copyright © 2008-2011 Yii Software LLC | ||
* @license http://www.yiiframework.com/license/ | ||
*/ | ||
|
||
/** | ||
* CConsoleCommandEvent class. | ||
* | ||
* CConsoleCommandEvent represents the event parameters needed by events raised by a console command. | ||
* | ||
* @author Evgeny Blinov <e.a.blinov@gmail.com> | ||
* @package system.console | ||
* @since 1.1.11 | ||
*/ | ||
class CConsoleCommandEvent extends CEvent | ||
{ | ||
/** | ||
* @var string the action name | ||
*/ | ||
public $action; | ||
/** | ||
* @var boolean whether the action should be executed. | ||
* If this property is set false by the event handler, the console command action will quit after handling this event. | ||
* If true, the normal execution cycles will continue, including performing the action and calling | ||
* {@link CConsoleCommand::afterAction}. | ||
*/ | ||
public $isContinue = true; | ||
|
||
/** | ||
* Constructor. | ||
* @param mixed $sender sender of the event | ||
* @param string $params the parameters to be passed to the action method. | ||
* @param string $action the action name | ||
*/ | ||
public function __construct($sender, $params, $action){ | ||
parent::__construct($sender, $params); | ||
$this->action = $action; | ||
} | ||
} |