Welcome Guest, Not a member yet? Register   Sign In
Problem with a driver
#1

[eluser]Unknown[/eluser]
Hi guys!

I'm trying to write my first CI driver, but I'm experiencing some problems with it... . It doesn't matter what I do, I always get the message that ci is unable to load the requested driver... .

Here is the file structure:
/application
/libraries
/DataObjectWrapper
DataObjectWrapper_customer_dow
DataObjectWrapper
Here is the constructor from my driver:
Code:
class DataObjectWrapper extends CI_Driver_Library implements do_wrapper
{
    protected $valid_drivers;
    protected $CI;

    /* @var $data_object DataObject */
    protected $data_object;
    /* @var $db DB */
    protected $db;

    public function __construct(Array $params)
    {
        $this->valid_drivers = array('dataobjectwrapper_customer_dow');
        $this->data_object = $params[0];
        $this->db = $params[1];
    }
}

And here is the child:
Code:
class Customer_DOW extends CI_Driver
{

    public function hi()
    {
        echo 'hi';
    }
}

Can somebody please tell me, whats going on?
#2

[eluser]Unknown[/eluser]
I think I know what the problem is.
I load the driver these way:
Code:
$this->load->driver('DataObjectWrapper',array($customer, $db));
$this->dataobjectwrapper->customer_dow->hi();
I can't load the driver with parameters. Afaik, the second parameter from the driver Method tells CI which childs to load.

But I need to give these parameters to my object. How can I do this?




Theme © iAndrew 2016 - Forum software by © MyBB