summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2007-10-09 15:25:27 +0200
committerDerek Allard <derek.allard@ellislab.com>2007-10-09 15:25:27 +0200
commitbefdc87b1ce6caf47c6f8b1dfa02333dfee8a950 (patch)
tree58c9c2ecc2c9fdf394a2d1a6d727d3e4ff07a136 /system/libraries
parent6838f00a708f53f834fb8a98af560177db1d1454 (diff)
Added the ability to auto-load Models
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Loader.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php
index 051d3d899..dd639798d 100644
--- a/system/libraries/Loader.php
+++ b/system/libraries/Loader.php
@@ -107,8 +107,19 @@ class CI_Loader {
*/
function model($model, $name = '', $db_conn = FALSE)
{
+ if (is_array($model))
+ {
+ foreach($model as $babe)
+ {
+ $this->model($babe);
+ }
+ return;
+ }
+
if ($model == '')
+ {
return;
+ }
// Is the model in a sub-folder? If so, parse out the filename and path.
if (strpos($model, '/') === FALSE)
@@ -855,6 +866,12 @@ class CI_Loader {
}
}
+ // Autoload models
+ if (isset($autoload['model']))
+ {
+ $this->model($autoload['model']);
+ }
+
// A little tweak to remain backward compatible
// The $autoload['core'] item was deprecated
if ( ! isset($autoload['libraries']))
@@ -875,6 +892,7 @@ class CI_Loader {
// Load the model class.
if (in_array('model', $autoload['libraries']))
{
+ die('made it in!');
$this->model();
$autoload['libraries'] = array_diff($autoload['libraries'], array('model'));
}