CodeIgniter Forums
Can not create own Driver - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Can not create own Driver (/thread-71124.html)



Can not create own Driver - cusp - 07-09-2018

Hi, 
I'm new on codeIgniter.

I've tryed to create my own driver - like it is described on CodeIgniter documentation

My Controller never finds the subclass.

If I try to run  
Code:
$this->driver_name->subclass_1->subclass_1();

CodeIgniter throws an Error - undefined property "subclass_1"
I have seen that in other tutorials the classes have to be extendet by CI_Driver (subclasses) and CI_Driver_Library (Driver Main Class)
AND: I need a constructor in the main driver:
Code:
public function __construct() {

       $this->valid_drivers = ['subclass_1'];

   }

I have debuged (xdebug) the codeIgniter and I think that is the right way.
So why is it not on the codeigniter documantation?
I'm doing something wrong?
When this is the right way - are there other parts in the documentation, where something like this is missing?

Or do I make a mistake?

cu


RE: Can not create own Driver - php_rocs - 07-10-2018

@cusp,

In your controller you should have this in your construct.
$this->load->library('your-driver-name');

You have to load the library in order for it to be accessible in the controller.