Reputation: 395
I have 2 applications: frontend and backend.
I am running the custom task with the following command:
php symfony newCron:createClusters --application=frontend
In each applications I have a lib
folder and a modules
folder. Through the above command only this apps->frontend->lib
folder is accessible, whereas the lib folder in apps->frontend->modules->module1->lib
is not accessible.
How can I access the module level lib files in my task?
I tried using the addOption command in the config method, but still nothing happens.
Upvotes: 0
Views: 1636
Reputation: 22756
I think you have two options.
The "symfony way"
Using autoload.yml
(in apps/frontend/config/autoload.yml
):
autoload:
my_module_lib:
path: %SF_APP_MODULE_DIR%/name_of_your_module/lib
recursive: true
The "php old way"
Using basic require_once
inside your task:
class createClustersTask extends sfBaseTask
{
/**
* @see sfTask
*/
protected function configure()
{
require_once sfConfig::get('sf_app_module_dir') . '/name_of_your_module/lib/name_of_your_first_lib.class.php';
require_once sfConfig::get('sf_app_module_dir') . '/name_of_your_module/lib/name_of_your_second_lib.class.php';
Upvotes: 1