We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

_ci_model_paths made protected - breaking AJAX Babble add-on

Developer Preview

Laisvunas's avatar
Laisvunas
879 posts
14 years ago
Laisvunas's avatar Laisvunas

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?

       
Laisvunas's avatar
Laisvunas
879 posts
14 years ago
Laisvunas's avatar Laisvunas

Hi again,

Nobody interested in EE v.2.2 breaking of add-ons?

I understand, that EE2.2 is released and dev preview program came to an end, but not everyone had time enough to test every add-on until June 22.

       
Robin Sowell's avatar
Robin Sowell
13,255 posts
14 years ago
Robin Sowell's avatar Robin Sowell

I’ll drop an email w/more details, but you don’t want to use _ci_model_paths- try reworking it with add_package_path instead. That workable?

       
Laisvunas's avatar
Laisvunas
879 posts
14 years ago
Laisvunas's avatar Laisvunas

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
       
Robin Sowell's avatar
Robin Sowell
13,255 posts
14 years ago
Robin Sowell's avatar Robin Sowell

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?

       
Laisvunas's avatar
Laisvunas
879 posts
14 years ago
Laisvunas's avatar Laisvunas

Hi Robin,

This solved my issue.

Thank you very much!!!

       
Robin Sowell's avatar
Robin Sowell
13,255 posts
14 years ago
Robin Sowell's avatar Robin Sowell

😉 Glad that did the trick. No doubt it will help someone out in the future as well!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.