Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter HMVC object_to_array() error

HMVC : https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/downloads

After downloading CI and copying over the HMVC, I'm getting the following error:

An uncaught Exception was encountered

Type: Error

Message: Call to undefined method MY_Loader::_ci_object_to_array()

Filename: /Users/k1ut2/Sites/nine.dev/application/third_party/MX/Loader.php

Line Number: 300

Backtrace:

File: /Users/k1ut2/Sites/nine.dev/application/controllers/Welcome.php Line: 23 Function: view

File: /Users/k1ut2/Sites/nine.dev/index.php Line: 315 Function: require_once

like image 335
whisky Avatar asked Jan 09 '17 22:01

whisky


1 Answers

Just adding this here as the Link provided by Clasyk isn't currently working...

The short version from that thread boils down to this...

In application/third_party/MX/Loader.php you can do the following...

Under public function view($view, $vars = array(), $return = FALSE) Look for... (Line 300)

return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return)); 

Replace this with

if (method_exists($this, '_ci_object_to_array')) {         return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return)); } else {         return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_prepare_view_vars($vars), '_ci_return' => $return)); } 

It's the result of a "little" undocumented change that the CI Devs implemented, which is fine!

There is a pull request on Wiredesignz awaiting action so he knows about it...

In the meantime, you can implement the above "diddle" and get back to coding :)

like image 107
TimBrownlaw Avatar answered Sep 24 '22 22:09

TimBrownlaw