Breaking: #87305 - Use constructor injection in DataMapper

See forge#87305

Description

Class \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper 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\CMS\Extbase\Persistence\Generic\Mapper\DataMapper using GeneralUtility::makeInstance or ObjectManager->get.

Migration

If possible, do not create instances yourself. Avoid GeneralUtility::makeInstance and ObjectManager->get. Instead use dependency injection, preferably constructor injection:

public function __constructor(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper $object)
{
    $this->property = $object;
}

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),
    // ...
);