Hi,
I was searching for a good solution to have the yii config files consistent when using yiic commands.
So the best way to merge main.php and command.php config files is the following I illustrate with command.php
<?php
// This is the configuration for yiic console application.
// Any writable CConsoleApplication properties can be configured here.
//
$mainConfigArray = include dirname(__FILE__).DIRECTORY_SEPARATOR.'main.php';
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'Cronjob Application',
'preload'=>array('log'),
'import'=>array(
'application.components.*',
'application.models.*',
),
'components'=>array(
'mail'=>$mainConfigArray['components']['mail'],
'db'=>$mainConfigArray['components']['db'],
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'logFile'=>'cron.log',
'levels'=>'error, warning',
),
array(
'class'=>'CFileLogRoute',
'logFile'=>'cron_trace.log',
'levels'=>'trace',
),
),
),
),
'params'=>$mainConfigArray['params'],
);
So all to do is, include the main.php config file and reuse the settings by putting the matching arrays (keys) into the console configuration.
Hope that helps !
Linus