Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to load external library in symfony 1.4?

I've searched a lot how to load/include a simple class in symfony 1.4 and i found nothing. I have this situation.

Under:

./apps/APP_NAME/
    modules/MOD_NAME/lib

I have a class:

class MyClass {
   function get_data(){
      retrun "data";
   }
}
  • Which is the best way to load in controller on symfony 1.4 the class?
  • Over on config exist some other way like function use_helper()?

Update: I want to load on demand, not to autoload with the convention of symfony 1.4 naming the file MyClass.class.php

like image 228
onalbi Avatar asked Dec 12 '25 12:12

onalbi


1 Answers

Is not the best but a first version that work under module ENV is:

    function load_module_lib($module, $name_file) {
       require_once (sfContext::getInstance()->getModuleDirectory() . '/../' . $module . '/lib/' . $name_file . '.class.php');
    }
like image 165
onalbi Avatar answered Dec 14 '25 06:12

onalbi