[eluser]gregormck[/eluser]
I have a function within a separate model that creates an array of data based on GET values like so:
Code:
$data_array = $this->some_model->some_function($this->input->get(null, true));
Within another model (e.g. "another_model") $data_array is used across many functions / methods. Rather than call "some_model->some_function" each time I access the other functions from within "another_model", I want to set $data_array as a variable that can be used across all functions within "another_model". Is this the correct way to do it:
Code:
class Another_model extends CI_model
{
private $data_array = array();
function __construct()
{
parent::__construct();
$this->data_array = $this->some_model->some_function($this->input->get(null, true));
}
public function_one()
{
// uses $this->data_array
}
private function_two()
{
// uses $this->data_array
}
}