mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
Use Injector to instantiate new base report instances
This commit is contained in:
parent
213f7167a6
commit
01f2663179
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace SilverStripe\Reports;
|
namespace SilverStripe\Reports;
|
||||||
|
|
||||||
|
use SilverStripe\Core\Injector\Injector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SS_ReportWrapper is a base class for creating report wappers.
|
* SS_ReportWrapper is a base class for creating report wappers.
|
||||||
*
|
*
|
||||||
@ -21,7 +23,7 @@ abstract class ReportWrapper extends Report
|
|||||||
|
|
||||||
public function __construct($baseReport)
|
public function __construct($baseReport)
|
||||||
{
|
{
|
||||||
$this->baseReport = is_string($baseReport) ? new $baseReport() : $baseReport;
|
$this->baseReport = is_string($baseReport) ? Injector::inst()->create($baseReport) : $baseReport;
|
||||||
$this->dataClass = $this->baseReport->dataClass();
|
$this->dataClass = $this->baseReport->dataClass();
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user