1: <?php
2: /**
3: * CConsoleCommandBehavior 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: /**
12: * CConsoleCommandBehavior is a base class for behaviors that are attached to a console command component.
13: *
14: * @property CConsoleCommand $owner The owner model that this behavior is attached to.
15: *
16: * @author Evgeny Blinov <e.a.blinov@gmail.com>
17: * @package system.console
18: * @since 1.1.11
19: */
20: class CConsoleCommandBehavior extends CBehavior
21: {
22: /**
23: * Declares events and the corresponding event handler methods.
24: * The default implementation returns 'onAfterConstruct', 'onBeforeValidate' and 'onAfterValidate' events and handlers.
25: * If you override this method, make sure you merge the parent result to the return value.
26: * @return array events (array keys) and the corresponding event handler methods (array values).
27: * @see CBehavior::events
28: */
29: public function events()
30: {
31: return array(
32: 'onBeforeAction' => 'beforeAction',
33: 'onAfterAction' => 'afterAction'
34: );
35: }
36: /**
37: * Responds to {@link CConsoleCommand::onBeforeAction} event.
38: * Override this method and make it public if you want to handle the corresponding event of the {@link CBehavior::owner owner}.
39: * @param CConsoleCommandEvent $event event parameter
40: */
41: protected function beforeAction($event)
42: {
43: }
44:
45: /**
46: * Responds to {@link CConsoleCommand::onAfterAction} event.
47: * Override this method and make it public if you want to handle the corresponding event of the {@link CBehavior::owner owner}.
48: * @param CConsoleCommandEvent $event event parameter
49: */
50: protected function afterAction($event)
51: {
52: }
53: }