Skip to content

Instantly share code, notes, and snippets.

@cornernote
Created May 25, 2015 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cornernote/5b050cb37d6ddd41ffd0 to your computer and use it in GitHub Desktop.
Save cornernote/5b050cb37d6ddd41ffd0 to your computer and use it in GitHub Desktop.
Yii2, how to run a command from another command?
<?php
namespace app\commands;
use yii\console\Controller;
use yii\helpers\Inflector;
class GiiQController extends Controller
{
public function actionCrud($table)
{
$model = Inflector::classify($table);
$command = 'gii/crud --modelClass="app\\models\\' . $model . '" --controllerClass="app\\modules\\admin\\controllers\\' . $model . 'Controller" --searchModelClass="app\\models\\search\\' . $model . '" --template="admin"';
// how to run command?
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment