When I upgraded my server to php7 codeigniter and in particular datamapper ORM gives me this error...
Message: Accessing static property DataMapper::$config as non static
Filename: libraries/datamapper.php Line Number: 6474
the function in question is...
protected function _dmz_assign_libraries()
{
static $CI;
if ($CI || $CI =& get_instance())
{
// make sure these exists to not trip __get()
$this->load = NULL;
$this->config = NULL;
$this->lang = NULL;
// access to the loader
$this->load =& $CI->load;
// to the config
$this->config =& $CI->config;
// and the language class
$this->lang =& $CI->lang;
}
}
You will be redirected to his documentation website . DataMapper is an Object Relational Mapper written in PHP for CodeIgniter. It is designed to map your Database tables into easy to work with objects, fully aware of the relationships between each other. Everything is an object!
If you are an existing Datamapper ORM user, you will find changes in new releases and upgrade instructions . Note: Datamapper ORM is now also available as a CI Spark: check out the cool way of extending CodeIgniter at getsparks.org!
After Phil had indicated he no longer had the time available to support his OverZealous Edition, Datamapper ORM is now being developed and maintained by WanWizard. This came from a desire to continue to enhance and develop DataMapper, and has been developed and maintained by Phil DeJarnett.
Some of the enhancements to the original DataMapper include: In-table foreign-keys for singular relationships. The ability to view, edit, and query using extra columns on relationship join tables. The ability to include data from singularly related objects. The ability to query and include data from deep relationships.
I have the same problem. To fix it, try to add new protected static method
protected static function get_config_object() {
$CI =& get_instance();
return $CI->config;
}
then delete or comment the lines 6474 and 6481 (in _dmz_assign_libraries
, where values are assigned to $this->config
),
and finally replace all calls $this->config
with self::get_config_object()
It should run correctly now.
Try to suppress error with @, eg:
@$this->config =& $CI->config;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With