Breaking: #87305 - Use constructor injection in DataMapper

See forge#87305


Class \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper does no longer use setter injection. Instead, constructor injection is used.


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.


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(
    // ...