Problems: Many times we have several related reports which use the same datasources. Putting connectionString in each report makes us difficulty to change connection for all reports later.

Solution: We can create a super class which holding all datasources connections then created derived report classes from this class.

Code:

//BaseReport.php
require_once "koolreport/autoload.php"

class BaseReport extends \koolreport\KoolReport
{
    protected function settings()
    {
            return array(
                "dataSources"=>array(
                    "sale"=>array(...),
                    "marketing"=>array(...),
                    "other_source"=>array(...),
                )
            )
    }
}

// SaleReport.php
require_once "BaseReport.php"

class SaleReport extends BaseReport
{
    protected function setup()
    {
        $this->src("sale")
        ->pipe(...)
        ...
    }
}
// MarketingReport.php
require_once "BaseReport.php"

class MarketingReport extends BaseReport
{
    protected function setup()
    {
        $this->src("marketing")
        ->pipe(...)
        ...
    }
}

This way your data source connection is managed nicely in once place.

Hope that this wiki helps you to build a nice and neat reports.

Regards.