mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-14 14:28:27 +08:00
Fixes #4914
This commit is contained in:
@ -27,4 +27,20 @@ class HelloController extends Controller
|
||||
{
|
||||
echo $message . "\n";
|
||||
}
|
||||
|
||||
public function actionTest()
|
||||
{
|
||||
echo 'Test?';
|
||||
}
|
||||
|
||||
// public function getDescription($actionID = null)
|
||||
// {
|
||||
// return "I'm custom description for $actionID!";
|
||||
// }
|
||||
|
||||
|
||||
public function getHelp($actionID = null)
|
||||
{
|
||||
return "I'm custom help for $actionID!";
|
||||
}
|
||||
}
|
||||
|
@ -103,9 +103,9 @@ class PhpDocController extends Controller
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function options($actionId)
|
||||
public function options($actionID)
|
||||
{
|
||||
return array_merge(parent::options($actionId), ['updateFiles']);
|
||||
return array_merge(parent::options($actionID), ['updateFiles']);
|
||||
}
|
||||
|
||||
protected function findFiles($root)
|
||||
|
@ -159,8 +159,8 @@ class ApiController extends BaseController
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function options($actionId)
|
||||
public function options($actionID)
|
||||
{
|
||||
return array_merge(parent::options($actionId), ['template', 'guide']);
|
||||
return array_merge(parent::options($actionID), ['template', 'guide']);
|
||||
}
|
||||
}
|
||||
|
@ -113,8 +113,8 @@ class GuideController extends BaseController
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function options($actionId)
|
||||
public function options($actionID)
|
||||
{
|
||||
return array_merge(parent::options($actionId), ['apiDocs']);
|
||||
return array_merge(parent::options($actionID), ['apiDocs']);
|
||||
}
|
||||
}
|
||||
|
@ -127,8 +127,8 @@ abstract class BaseController extends Controller
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function options($actionId)
|
||||
public function options($actionID)
|
||||
{
|
||||
return array_merge(parent::options($actionId), ['template', 'exclude']);
|
||||
return array_merge(parent::options($actionID), ['template', 'exclude']);
|
||||
}
|
||||
}
|
||||
|
@ -168,9 +168,9 @@ class FixtureController extends \yii\console\controllers\FixtureController
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function options($actionId)
|
||||
public function options($actionID)
|
||||
{
|
||||
return array_merge(parent::options($actionId), [
|
||||
return array_merge(parent::options($actionID), [
|
||||
'templatePath', 'language', 'fixtureDataPath'
|
||||
]);
|
||||
}
|
||||
|
@ -73,10 +73,10 @@ class MigrateController extends BaseMigrateController
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function options($actionId)
|
||||
public function options($actionID)
|
||||
{
|
||||
return array_merge(
|
||||
parent::options($actionId),
|
||||
parent::options($actionID),
|
||||
['migrationCollection', 'db'] // global for all actions
|
||||
);
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ Yii Framework 2 Change Log
|
||||
- Enh #2526: Allow for null values in batchInsert (skotos)
|
||||
- Enh #2646: Added support for specifying hostinfo in the pattern of a URL rule (qiangxue)
|
||||
- Enh #2661: Added boolean column type support for SQLite (qiangxue)
|
||||
- Enh #2670: Changed `console\Controller::globalOptions()` to `options($actionId)` to (make it possible to) differentiate options per action (hqx)
|
||||
- Enh #2670: Changed `console\Controller::globalOptions()` to `options($actionID)` to (make it possible to) differentiate options per action (hqx)
|
||||
- Enh #2714: Added support for formatting time intervals relative to the current time with `yii\base\Formatter` (drenty)
|
||||
- Enh #2726: Added `yii\db\ActiveRecord::loadDefaultValues()` that fills default values from DB schema (samdark)
|
||||
- Enh #2729: Added `FilterValidator::skipOnArray` so that filters like `trim` will not fail for array inputs (qiangxue)
|
||||
|
@ -267,10 +267,10 @@ class Controller extends \yii\base\Controller
|
||||
* Note that the values setting via options are not available
|
||||
* until [[beforeAction()]] is being called.
|
||||
*
|
||||
* @param string $actionId the action id of the current request
|
||||
* @param string $actionID the action id of the current request
|
||||
* @return array the names of the options valid for the action
|
||||
*/
|
||||
public function options($actionId)
|
||||
public function options($actionID)
|
||||
{
|
||||
// $id might be used in subclass to provide options specific to action id
|
||||
return ['color', 'interactive'];
|
||||
|
@ -45,12 +45,12 @@ abstract class BaseMigrateController extends Controller
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function options($actionId)
|
||||
public function options($actionID)
|
||||
{
|
||||
return array_merge(
|
||||
parent::options($actionId),
|
||||
parent::options($actionID),
|
||||
['migrationPath'], // global for all actions
|
||||
($actionId == 'create') ? ['templateFile'] : [] // action create
|
||||
($actionID == 'create') ? ['templateFile'] : [] // action create
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -71,9 +71,9 @@ class FixtureController extends Controller
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function options($actionId)
|
||||
public function options($actionID)
|
||||
{
|
||||
return array_merge(parent::options($actionId), [
|
||||
return array_merge(parent::options($actionID), [
|
||||
'namespace', 'globalFixtures', 'append'
|
||||
]);
|
||||
}
|
||||
|
@ -72,10 +72,10 @@ class MigrateController extends BaseMigrateController
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function options($actionId)
|
||||
public function options($actionID)
|
||||
{
|
||||
return array_merge(
|
||||
parent::options($actionId),
|
||||
parent::options($actionID),
|
||||
['migrationTable', 'db'] // global for all actions
|
||||
);
|
||||
}
|
||||
|
@ -77,16 +77,16 @@ class AssetControllerTest extends TestCase
|
||||
|
||||
/**
|
||||
* Emulates running of the asset controller action.
|
||||
* @param string $actionId id of action to be run.
|
||||
* @param string $actionID id of action to be run.
|
||||
* @param array $args action arguments.
|
||||
* @return string command output.
|
||||
*/
|
||||
protected function runAssetControllerAction($actionId, array $args = [])
|
||||
protected function runAssetControllerAction($actionID, array $args = [])
|
||||
{
|
||||
$controller = $this->createAssetController();
|
||||
ob_start();
|
||||
ob_implicit_flush(false);
|
||||
$controller->run($actionId, $args);
|
||||
$controller->run($actionID, $args);
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
@ -51,16 +51,16 @@ abstract class BaseMessageControllerTest extends TestCase
|
||||
|
||||
/**
|
||||
* Emulates running of the message controller action.
|
||||
* @param string $actionId id of action to be run.
|
||||
* @param string $actionID id of action to be run.
|
||||
* @param array $args action arguments.
|
||||
* @return string command output.
|
||||
*/
|
||||
protected function runMessageControllerAction($actionId, array $args = [])
|
||||
protected function runMessageControllerAction($actionID, array $args = [])
|
||||
{
|
||||
$controller = $this->createMessageController();
|
||||
ob_start();
|
||||
ob_implicit_flush(false);
|
||||
$controller->run($actionId, $args);
|
||||
$controller->run($actionID, $args);
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
@ -63,16 +63,16 @@ trait MigrateControllerTestTrait
|
||||
|
||||
/**
|
||||
* Emulates running of the migrate controller action.
|
||||
* @param string $actionId id of action to be run.
|
||||
* @param string $actionID id of action to be run.
|
||||
* @param array $args action arguments.
|
||||
* @return string command output.
|
||||
*/
|
||||
protected function runMigrateControllerAction($actionId, array $args = [])
|
||||
protected function runMigrateControllerAction($actionID, array $args = [])
|
||||
{
|
||||
$controller = $this->createMigrateController();
|
||||
ob_start();
|
||||
ob_implicit_flush(false);
|
||||
$controller->run($actionId, $args);
|
||||
$controller->run($actionID, $args);
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
@ -38,15 +38,15 @@ class UrlTest extends TestCase
|
||||
* Mocks controller action with parameters
|
||||
*
|
||||
* @param string $controllerId
|
||||
* @param string $actionId
|
||||
* @param string $actionID
|
||||
* @param string $moduleID
|
||||
* @param array $params
|
||||
*/
|
||||
protected function mockAction($controllerId, $actionId, $moduleID = null, $params = [])
|
||||
protected function mockAction($controllerId, $actionID, $moduleID = null, $params = [])
|
||||
{
|
||||
\Yii::$app->controller = $controller = new Controller($controllerId, \Yii::$app);
|
||||
$controller->actionParams = $params;
|
||||
$controller->action = new Action($actionId, $controller);
|
||||
$controller->action = new Action($actionID, $controller);
|
||||
|
||||
if ($moduleID !== null) {
|
||||
$controller->module = new Module($moduleID);
|
||||
|
Reference in New Issue
Block a user