Breaking: #96904 - ext:reports reports do not receive parent object¶
See forge#96904
Description¶
Extensions that add own reports in EXT:reports do not receive an instance
of \TYPO3\
as constructor
argument anymore.
Handing over "parent object" to single reports as manual constructor argument
was pretty much useless since all state in Report
is protected
. Not having this constructor argument has the advantage
that reports can now use dependency injection.
Impact¶
Extensions that register own reports to the EXT:reports extension and type hint
Report
as constructor argument will trigger a fatal PHP error
since that argument is no longer provided by the API.
Affected Installations¶
Instances with extensions that add own reports to EXT:reports may be affected.
Migration¶
Do not expect to retrieve an instance of Report
as constructor
argument anymore. Code before:
class MyClass implements ReportInterface
{
public function __construct(ReportController $reportController)
{
// ...
}
}
class MyClass implements ReportInterface
{
// No manual constructor argument anymore, but have a dependency injection as example.
public function __construct(private readonly SomeDependency $someDependency)
{
}
}
Single reports are currently instantiated using General
.
To use dependency injection in own reports, a report class thus needs to be defined
public: true
in a Configuration/
file. This may change with
further TYPO3 v12 development if the reports registration is changed, though. If in doubt,
just try to go without public: true
. If this leads to a fatal PHP error, add it.