Hi,
There was much talk about _ci_view_path making protected. Now it is made deprecated and set_package_path is being advised to use.
But I found that in EE2.2 another CI variable - _ci_model_paths has also been made protected and now it breaks my add-on AJAX Babble.
This add-on outputs this error:
Fatal error: Cannot access protected property EE_Loader::$_ci_model_paths in /home/admin/antiquityillustrated.org/eesys/expressionengine/third_party/ajax_babble/pi.ajax_babble.php on line 264
Is there a workaround? Or perhaps it is possible to make _ci_model_paths deprecated in the next build and introduce some substitution for add-on developers?
Hi Robin,
Thanks for the suggestion.
My code which was broken by EE2.2 is this
if ( ! class_exists('Comment'))
{
require PATH_MOD.'comment/'.'mod.comment.php';
}
$COMM = new Comment();
array_push($this->EE->load->_ci_model_paths, PATH_MOD.'comment/');
$COMM->insert_new_comment();
If I understood you correctly, it should be replaced by this code:
$this->EE->load->add_package_path(PATH_MOD.'comment/');
$this->EE->load->library('comment');
$this->EE->comment->insert_new_comment();
Unfortunately, this code does not work. I get this error message:
Unable to load the requested class: comment
We won’t discuss how long it took for me to spot the problem. Or the fact I had to ask Pascal. There… is no comment library.
I haven’t fully tested what you’re doing- but I can load the model via:
$this->EE->load->add_package_path(PATH_MOD.'comment/');
$this->EE->load->model('comment_model');
require PATH_MOD.'comment/'.'mod.comment.php';
$COMM = new Comment();
Hee- can’t believe we both missed it! That get things going?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.