Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Sorry for our late reply. We have no datasource for existed PDO so you can create one like this:
1- Create a ExistedPdoDataSource.php
with following content:
class ExistedPdoDataSource extends \koolreport\datasources\PdoDataSource
{
protected function onInit()
{
$this->connection = Utility::get($this->params,"pdo");
}
}
2- In your report, you can use the above datasource like this:
require_once "ExistedPdoDataSource.php";
class MyReport extends \koolreport\KoolReport
{
function settings()
{
return array(
"dataSources"=>array(
"class"=>ExistedPdoDataSource::class,
"pdo"=>$this->params["pdo"]
)
);
}
...
}
3 - To render report, you do this
require_once "/path/to/koolreport/core/autoload.php";
require_once "MyReport.php";
$report = new MyReport(array(
"pdo"=>$conn
));
$report->run()->render();
Hope that helps.
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo