Class yii\shell\ShellController
| Inheritance | yii\shell\ShellController » yii\console\Controller |
|---|---|
| Available since extension's version | 2.0 |
| Source Code | https://github.com/yiisoft/yii2-shell/blob/master/ShellController.php |
Runs interactive shell. That is especially useful when developing an application and you want to try some method of your code.
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $include | array | Include file(s) before starting tinker shell | yii\shell\ShellController |
| $shellConfig | array | PsySH shell configuration array | yii\shell\ShellController |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| actionIndex() | Runs interactive shell | yii\shell\ShellController |
| options() | yii\shell\ShellController |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| getCasters() | yii\shell\ShellController |
Property Details
PsySH shell configuration array
Method Details
Runs interactive shell
| public void actionIndex ( ) |
public function actionIndex()
{
$config = new Configuration;
$config->loadConfig($this->shellConfig);
$config->getPresenter()->addCasters(
$this->getCasters()
);
$shell = new Shell($config);
$shell->setIncludes($this->include);
$shell->run();
}
| protected array getCasters ( ) | ||
| return | array |
Casters for psysh |
|---|---|---|
protected function getCasters()
{
return [
'yii\db\ActiveRecord' => 'yii\shell\YiiCaster::castModel',
];
}
| public void options ( $actionID ) | ||
| $actionID | ||
public function options($actionID)
{
return array_merge(parent::options($actionID), [
'include'
]);
}