Same connection to Console commands - migration

Hi,

How i can re-use the same connection of "main.php" in "console.php" without need change "console.php" everytime that i change "main.php" ?

I can think of three approaches

  1. arrayMerge, just like in test.php (will include irrelevant parts of main.php)

  2. ‘db’=>require ‘db.php’, // db.php returns an connection array

  3. something like this




   $webConfig = require 'main.php';

   ...

   return array {

     ...

     'components'=>array(

       'db'=>$webConfig['components']['db'],

     ),

  ),



/Tommy

Hi, thanks man, your third solution is the best.

My problem was solved:


$mainConfig = require(dirname(__FILE__) . '/main.php');


return CMap::mergeArray(

	array(

		'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

		'name'=>'Auction Platform - Console Application',

		'components'=>array(

			'db' => $mainConfig['components']['db'],

		),

	)

);