From 01f26631792a4bc5d06f38d670fd9db4264a45d0 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Fri, 22 Mar 2019 13:58:43 +1300 Subject: [PATCH] Use Injector to instantiate new base report instances --- code/ReportWrapper.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/ReportWrapper.php b/code/ReportWrapper.php index 88c1ca89..8c0daec6 100644 --- a/code/ReportWrapper.php +++ b/code/ReportWrapper.php @@ -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(); }