Background:
I got a web application, and now I'm extending it with console access for cron jobs in the future.
I'm using 2 separate config files, "main.php" for the Yii Web Application, "console.php" for the Yii Console Application.
Problem:
I'm using modules extensively.
I have build my own "Default Module".
All the other modules extend from this Default Module.
In my web application I make this work by editing the "main.php" config file like this:
This works, great!
But I want to do the same for the Console part, so to the console config, I add this same snippet of code but it doesn't work....
I have found a way to fix it though, by adding the following to my "console.php":
So this solution makes it work,
but why do I have to do this for the Console and not for the Web ?
My question:
Why do I have to manually add the controllers, models, and views directories of my Default module like this in my "console.php" config file in the IMPORT array,
while I do not have to do this in my Web application "main.php" config file?
I "solved" it this way, but it's dirtier and I don't trust it, because in the future if I'm going to extend from other modules, I might run into the same problems.
Could someone help me with the correct solution, or point out the problem ?
I got a web application, and now I'm extending it with console access for cron jobs in the future.
I'm using 2 separate config files, "main.php" for the Yii Web Application, "console.php" for the Yii Console Application.
Problem:
I'm using modules extensively.
I have build my own "Default Module".
All the other modules extend from this Default Module.
In my web application I make this work by editing the "main.php" config file like this:
// Web Application config 'modules'=>array( 'default', 'clients', 'household' ), 'import'=>array( 'application.components.*', 'application.models.*', 'application.helpers.*', ),
This works, great!
But I want to do the same for the Console part, so to the console config, I add this same snippet of code but it doesn't work....
I have found a way to fix it though, by adding the following to my "console.php":
// Console Application config 'modules'=>array( 'default', 'clients', 'household' ) 'import'=>array( 'application.components.*', 'application.models.*', 'application.modules.default.controllers.*', // Line I have to add 'application.modules.default.models.*', // Line I have to add 'application.modules.default.views.*', // Line I have to add 'application.helpers.*', ),
So this solution makes it work,
but why do I have to do this for the Console and not for the Web ?
My question:
Why do I have to manually add the controllers, models, and views directories of my Default module like this in my "console.php" config file in the IMPORT array,
while I do not have to do this in my Web application "main.php" config file?
I "solved" it this way, but it's dirtier and I don't trust it, because in the future if I'm going to extend from other modules, I might run into the same problems.
Could someone help me with the correct solution, or point out the problem ?