Jump to content

sql_autoload_register using object?


Cardale

Recommended Posts

You need to use an array that pointts to the class defintition of your $LOADER object. You can't actually place an instantiated object in there, after all, your trying to autoload an object. I'm also not sure you can pass an argument to your method.

 

<?php spl_autoload_register(array('Loader','ModelLoad')); ?>

Tried this and it wouldn't work either.

 

I also tried it without the constant...didn't go so good. 

 

<?php	
        $LOADER = new LOADER(APPLICATION);
$MODEL_LOAD = $LOADER->MODEL_LOAD(MODEL);
$CONTROLLER_LOAD = $LOADER->CONTROLLER_LOAD(CONTROLLER);
$VIEW_LOAD = $LOADER->VIEW_LOAD(VIEW);

   spl_autoload_register(array($LOADER, $MODEL_LOAD));
   spl_autoload_register(array($LOADER, $CONTROLLER_LOAD));
   spl_autoload_register(array($LOADER, $VIEW_LOAD));

var_dump(spl_autoload_functions());
?>

 

Fatal error: Uncaught exception 'LogicException' with message 'Passed array does not specify an existing static method' in

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.