I'm trying to implement a class I've written as CodeIgniter library.
Somehow I can't get CI's load()
method to pass multiple arguments to the class's constructor function.
My class is designed to get 3 arguments, 2 arrays and one optional string.
The constructor looks somewhat like this:
public function __construct($array, $array,$string=""){
/** code **/
}
The relevant part from the controller:
function index(){
$array1 = array('key1'=>'value','key2'=>'value');
$array2 = array('key1'=>'value','key2'=>'value');
$string = "value";
$params = array($array1,$array2,$string);
$this->load->library("MyClass",$params);
}
Loading the controller generates this error :
Message: Missing argument 2 for MyClass::__construct()
This is really puzzling me. It seems the first argument gets sent fine and then it chokes on the second argument. Any clues on why this is happening will be greatly appreciated.