1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
5 * An open source application development framework for PHP 4.3.2 or newer
8 * @author ExpressionEngine Dev Team
9 * @copyright Copyright (c) 2008, EllisLab, Inc.
10 * @license http://codeigniter.com/user_guide/license.html
11 * @link http://codeigniter.com
16 // ------------------------------------------------------------------------
19 * CodeIgniter Model Class
21 * @package CodeIgniter
22 * @subpackage Libraries
24 * @author ExpressionEngine Dev Team
25 * @link http://codeigniter.com/user_guide/libraries/config.html
29 var $_parent_name = '';
38 // If the magic __get() or __set() methods are used in a Model references can't be used.
39 $this->_assign_libraries( (method_exists($this, '__get') OR method_exists($this, '__set')) ? FALSE : TRUE );
41 // We don't want to assign the model object to itself when using the
42 // assign_libraries function below so we'll grab the name of the model parent
43 $this->_parent_name = ucfirst(get_class($this));
45 log_message('debug', "Model Class Initialized");
51 * Creates local references to all currently instantiated objects
52 * so that any syntax that can be legally used in a controller
53 * can be used within models.
57 function _assign_libraries($use_reference = TRUE)
59 $CI =& get_instance();
60 foreach (array_keys(get_object_vars($CI)) as $key)
62 if ( ! isset($this->$key) AND $key != $this->_parent_name)
64 // In some cases using references can cause
65 // problems so we'll conditionally use them
66 if ($use_reference == TRUE)
68 $this->$key = NULL; // Needed to prevent reference errors with some configurations
69 $this->$key =& $CI->$key;
73 $this->$key = $CI->$key;
82 /* End of file Model.php */
83 /* Location: ./system/libraries/Model.php */