mirror of
https://github.com/yiisoft/yii2.git
synced 2025-12-03 00:18:12 +08:00
Extracted inline action object creation, implemented it in console controller in order to use console inline action instead of base one
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,6 +228,18 @@ class Controller extends Component implements ViewContextInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user