summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/config/autoload.php8
-rw-r--r--system/core/Loader.php4
-rw-r--r--user_guide_src/source/changelog.rst1
-rw-r--r--user_guide_src/source/general/autoloader.rst2
4 files changed, 10 insertions, 5 deletions
diff --git a/application/config/autoload.php b/application/config/autoload.php
index 40f0a6520..5a20c943a 100644
--- a/application/config/autoload.php
+++ b/application/config/autoload.php
@@ -148,12 +148,16 @@ $autoload['language'] = array();
| -------------------------------------------------------------------
| Prototype:
|
-| $autoload['model'] = array('model1', 'model2');
+| $autoload['model'] = array('first_model', 'second_model');
|
+| You can also supply an alternative model name to be assigned
+| in the controller:
+|
+| $autoload['model'] = array('first_model' => 'first');
*/
$autoload['model'] = array();
/* End of file autoload.php */
-/* Location: ./application/config/autoload.php */
+/* Location: ./application/config/autoload.php */ \ No newline at end of file
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 9bfddc15a..4d95d6288 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -233,9 +233,9 @@ class CI_Loader {
}
elseif (is_array($model))
{
- foreach ($model as $class)
+ foreach ($model as $key => $value)
{
- $this->model($class);
+ $this->model(is_int($key) ? $value : $key, $value);
}
return;
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 2966f659f..989999929 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -285,6 +285,7 @@ Release Date: Not Released
- Added autoloading of drivers with ``$autoload['drivers']``.
- ``$config['rewrite_short_tags']`` now has no effect when using PHP 5.4 as ``<?=`` will always be available.
- Changed method ``config()`` to return whatever ``CI_Config::load()`` returns instead of always being void.
+ - Added support for model aliasing on autoload.
- :doc:`Input Library <libraries/input>` changes include:
- Added ``method()`` to retrieve ``$_SERVER['REQUEST_METHOD']``.
- Added support for arrays and network addresses (e.g. 192.168.1.1/24) for use with the *proxy_ips* setting.
diff --git a/user_guide_src/source/general/autoloader.rst b/user_guide_src/source/general/autoloader.rst
index e5cec723b..bf2e3935a 100644
--- a/user_guide_src/source/general/autoloader.rst
+++ b/user_guide_src/source/general/autoloader.rst
@@ -15,7 +15,7 @@ The following items can be loaded automatically:
- Language files found in the *system/language/* directory
- Models found in the *models/* folder
-To autoload resources, open the *application/config/autoload.php*
+To autoload resources, open the **application/config/autoload.php**
file and add the item you want loaded to the autoload array. You'll
find instructions in that file corresponding to each type of item.