Use Injector to instantiate new base report instances

This commit is contained in:
Robbie Averill 2019-03-22 13:58:43 +13:00 committed by Guy Sartorelli
parent 213f7167a6
commit 01f2663179
No known key found for this signature in database
GPG Key ID: F313E3B9504D496A
1 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,8 @@
namespace SilverStripe\Reports;
use SilverStripe\Core\Injector\Injector;
/**
* SS_ReportWrapper is a base class for creating report wappers.
*
@ -21,7 +23,7 @@ abstract class ReportWrapper extends Report
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();
parent::__construct();
}