Breaking: #87305 - Use constructor injection in DataMapper
See forge#87305
Description
Class \TYPO3\
does no longer use setter injection. Instead, constructor injection is used.
Impact
The method signature of the constructor changed. This means:
- The amount of constructor arguments increased
- The order of arguments possibly changed
Affected Installations
All installations that create instances of the class \TYPO3\
using General
or Object
.
Migration
If possible, do not create instances yourself. Avoid General
and Object
. Instead use dependency injection, preferably constructor injection:
public function __constructor(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper $object)
{
$this->property = $object;
}
Copied!
If dependency injection is not possible, check the dependencies and instantiate objects via the object manager:
$object = $objectManager->get(
\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::class,
$objectManager->get(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class),
// ...
);
Copied!