In many cases, you have your own data stored in PHP array. The data could be result of your previous processes and we would like to input those data to report:
<?php
//Our sample data in array
$myData = array(
array("name"=>"Peter","age"=>30),
array("name"=>"Mary","age"=>25),
);
$report = new MyReport(array(
"data"=>$myData //Insert data into MyReport as parameters.
));
$report->run()->render();
In the settings() function of MyReport, you can set the data source like this
public function settings()
{
return array(
"dataSources"=>array(
"mydata"=>array(
"class"=>"\koolreport\datasources\ArrayDataSource",
"data"=>$this->params["data"],
"dataFormat"=>"associate"
)
)
);
}
And in the setup() function, you can do:
protected function setup()
{
$this->src('mydata')
...
->pipe($this->dataStore("test"))
}
Please leave your comment.