Problem Loading Extended Library From Third_Party |
[eluser]volition23[/eluser]
As detailed in this thread: http://ellislab.com/forums/viewthread/210279/ I've been doing some work to leverage the third_party directory for shared code among multiple apps. I took Aken's advice to extend the Form_validation library's _execute() method with my new code snippet, and I created the following file in which the default Form_validation library is extended: /some.application/third_party/shared/libraries/MY_Form_validation.php Unfortunately, when I adjusted the code in my controller to call my extended class, I lost the validation behavior provided by my phone number helper. After some debugging, I determined the original Form_validation library was being instantiated and not my extended library. The reason is found in Loader::_ci_load_class(). Loader only looks for subclasses in the application's libraries folder and doesn't take into account those folders specified through Loader::add_package_path(). It WILL load stand-alone libraries that are not extensions of existing libraries however. The reason is the following: Code: foreach (array(ucfirst($class), strtolower($class)) as $class) As you can see, it's only checking the application's (APPPATH) libraries directory. I changed the above to the following, and my extended library now loads from APPPATH/third_party/shared/libraries. Code: foreach (array(ucfirst($class), strtolower($class)) as $class) Can anyone see any reason why the loading of a subclass shouldn't work this way? Thanks. |
Messages In This Thread |
Problem Loading Extended Library From Third_Party - by El Forum - 02-03-2012, 07:19 PM
Problem Loading Extended Library From Third_Party - by El Forum - 02-03-2012, 07:56 PM
Problem Loading Extended Library From Third_Party - by El Forum - 02-03-2012, 08:06 PM
Problem Loading Extended Library From Third_Party - by El Forum - 02-04-2012, 12:45 AM
Problem Loading Extended Library From Third_Party - by El Forum - 02-04-2012, 12:03 PM
Problem Loading Extended Library From Third_Party - by El Forum - 02-04-2012, 12:25 PM
Problem Loading Extended Library From Third_Party - by El Forum - 02-04-2012, 03:14 PM
Problem Loading Extended Library From Third_Party - by El Forum - 02-04-2012, 03:24 PM
Problem Loading Extended Library From Third_Party - by El Forum - 02-04-2012, 04:25 PM
Problem Loading Extended Library From Third_Party - by El Forum - 02-04-2012, 04:51 PM
|