Public Member Functions | |
| Model () | |
| Constructor. | |
| _assign_libraries ($use_reference=TRUE) | |
| Assign Libraries. | |
Public Attributes | |
| $_parent_name = '' | |
Definition at line 27 of file Model.php.
| Model::_assign_libraries | ( | $ | use_reference = TRUE |
) |
Assign Libraries.
Creates local references to all currently instantiated objects so that any syntax that can be legally used in a controller can be used within models.
private
Definition at line 57 of file Model.php.
References $CI, and get_instance().
Referenced by Model().
00058 { 00059 $CI =& get_instance(); 00060 foreach (array_keys(get_object_vars($CI)) as $key) 00061 { 00062 if ( ! isset($this->$key) AND $key != $this->_parent_name) 00063 { 00064 // In some cases using references can cause 00065 // problems so we'll conditionally use them 00066 if ($use_reference == TRUE) 00067 { 00068 // Needed to prevent reference errors with some configurations 00069 $this->$key = ''; 00070 $this->$key =& $CI->$key; 00071 } 00072 else 00073 { 00074 $this->$key = $CI->$key; 00075 } 00076 } 00077 } 00078 }


| Model::Model | ( | ) |
Constructor.
public
Definition at line 36 of file Model.php.
References _assign_libraries(), and log_message().
00037 { 00038 // If the magic __get() or __set() methods are used in a Model references can't be used. 00039 $this->_assign_libraries( (method_exists($this, '__get') OR method_exists($this, '__set')) ? FALSE : TRUE ); 00040 00041 // We don't want to assign the model object to itself when using the 00042 // assign_libraries function below so we'll grab the name of the model parent 00043 $this->_parent_name = ucfirst(get_class($this)); 00044 00045 log_message('debug', "Model Class Initialized"); 00046 }
