Commit d74e89a1 by Alexander Makarov

Extracted inline action object creation, implemented it in console controller in…

Extracted inline action object creation, implemented it in console controller in order to use console inline action instead of base one
parent c43b7ee8
......@@ -220,7 +220,7 @@ class Controller extends Component implements ViewContextInterface
if (method_exists($this, $methodName)) {
$method = new \ReflectionMethod($this, $methodName);
if ($method->isPublic() && $method->getName() === $methodName) {
return new InlineAction($id, $this, $methodName);
return $this->createActionObject($id, $methodName);
}
}
}
......@@ -229,6 +229,18 @@ class Controller extends Component implements ViewContextInterface
}
/**
* Creates action object instance
*
* @param string $id the ID of this action
* @param string $methodName the controller method that action is associated with
* @return \yii\base\InlineAction
*/
protected function createActionObject($id, $methodName)
{
return new InlineAction($id, $this, $methodName);
}
/**
* This method is invoked right before an action is executed.
*
* The method will trigger the [[EVENT_BEFORE_ACTION]] event. The return value of the method
......
......@@ -9,7 +9,6 @@ namespace yii\console;
use Yii;
use yii\base\Action;
use yii\base\InlineAction;
use yii\base\InvalidRouteException;
use yii\helpers\Console;
......@@ -61,6 +60,15 @@ class Controller extends \yii\base\Controller
}
/**
* @inheritdoc
* @return \yii\console\InlineAction
*/
protected function createActionObject($id, $methodName)
{
return new InlineAction($id, $this, $methodName);
}
/**
* Runs an action with the specified action ID and parameters.
* If the action ID is empty, the method will use [[defaultAction]].
* @param string $id the ID of the action to be executed.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment