Comparing
#2 with
#3
Content
[...]
### Run yiic migrate in an action
#### Code
```php
private function runMigrationTool() {
$commandPath = Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . 'commands';
$runner = new CConsoleCommandRunner();
$runner->addCommands($commandPath);
$commandPath = Yii::getFrameworkPath() . DIRECTORY_SEPARATOR . 'cli' . DIRECTORY_SEPARATOR . 'commands';
$runner->addCommands($commandPath);
$args = array(
'command', 'yiic', 'migrate', '--interactive=0');
$command = $runner->createCommand($args[0]);
array_shift($args);
ob_start();
$runner->run($args);
echo htmlentities(ob_get_clean(), null, Yii::app()->charset);
}
```
#### How to use
You can call it from a controller action like this:
```php[...]