Cardale Posted April 1, 2008 Share Posted April 1, 2008 $LOADER is the class model_load is my function inside the LOADER class and MODEL is just a constant that defines the correct folder using in the MODEL_LOAD function. What am I doing wrong here? spl_autoload_register($LOADER->MODEL_LOAD(MODEL)); Link to comment https://forums.phpfreaks.com/topic/98941-sql_autoload_register-using-object/ Share on other sites More sharing options...
trq Posted April 1, 2008 Share Posted April 1, 2008 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')); ?> Link to comment https://forums.phpfreaks.com/topic/98941-sql_autoload_register-using-object/#findComment-506431 Share on other sites More sharing options...
Cardale Posted April 2, 2008 Author Share Posted April 2, 2008 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 Link to comment https://forums.phpfreaks.com/topic/98941-sql_autoload_register-using-object/#findComment-507145 Share on other sites More sharing options...
Cardale Posted April 2, 2008 Author Share Posted April 2, 2008 Actually if anyone knows of any working examples of this I'd like to take a look thanks. Link to comment https://forums.phpfreaks.com/topic/98941-sql_autoload_register-using-object/#findComment-507147 Share on other sites More sharing options...
Cardale Posted April 2, 2008 Author Share Posted April 2, 2008 never mind I got it working....I think... Link to comment https://forums.phpfreaks.com/topic/98941-sql_autoload_register-using-object/#findComment-507166 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.