• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extending CI_Exceptions

#1
Hello,
I'm trying to extend CI_Exceptions but I can't access the load method in my sub class.
I tried :
PHP Code:
class MY_Exceptions extends CI_Exceptions {

    protected $CI;

 
   public function __construct()
 
   {
 
       parent::__construct();
 
       $this->CI =& get_instance();
 
       $this->CI->load->library('SOMELIBRARY');
 
   
Thanks in advance,
Reply

#2
This might help ... http://www.codeigniter.com/user_guide/ge...t-instance
Reply

#3
As mentionend previously, I tried this method.
The error output : Fatal error: Call to a member function library() on a non-object in
Reply

#4
Sorry - I was looking at your original github issue, where you had $this->load...

If still getting an undefined property, that suggests to me that the CI instance is not fully constructed when the Exceptions class is loaded, and that you might have to reference CI etc in one of the work methods, eg log_exception(...)
Reply

#5
I tried to use $this->_CI->load->library('twig'); in the show_error method without success.
Error output : Message: Trying to get property of non-object.
BTW I extended the Loader class and could not load a library in the constructor. However, it worked in the methods.
I guess CI_Loader is instantiated before CI_Exceptions.
What could be a good solution to my problem ?
Reply

#6
Any news ?
Reply

#7
CI is not yet loaded so you will get an Error.

See CodeIgniter.php to see how it is loading things.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.