Yii Override Command Parameters
The Yii Framework is very flexible and has a variety of way you can configure it. Here I will show you how you can customize parameters on a Command task.
The default Yii Migration command asks the user for a confirmation before running if there are any tables that have been changed, this is quite a sensible default, but I don’t want to be asked if the command should be run after a deployment. Of course it should be.
To see what options can be configured, open the Migrations file
vendors/framework/cli/commands/MigrateCommand.php
Any of the public class variables can be configured in your config/console.php
file. Using the commandMap parameter, you can configure values for Yii Commands. Then specify the migrate task, and then the config values you want to change. In this case, I want to change interactive to false, so it won’t ask for a confirmation.
Sample config/console.php:
return array(
...
// database migration, don't ask for confirmation
'commandMap'=>array(
'migrate'=>array(
'class'=>'system.cli.commands.MigrateCommand',
'interactive'=>false,
),
),
);