Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Different instantiation of a module
#1
I see that we have:

PHP Code:
        $modname 'SalesOrder';
        
$module Vtiger_Module::getInstance($modname); 

To get a module instance. But is that (and if so, how) different from

PHP Code:
$so_focus = new SalesOrder(); 
?
Reply
#2
The difference is that getInstance() will include the class file for you. In other words,

$focus = new XX();

requires that you have previously done

require_once('modules/XX/XX.php');

while the getInstance will check if the file is not loaded yet and load it for you
Joe
TSolucio
Reply
#3
Ah, good to know. But any way you instantiate, the same methods will be available?
Reply
#4
yes, it is exactly the same, getInstance() ends creating a new XX()
Joe
TSolucio
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)