Skip to content

Instantly share code, notes, and snippets.

@Digi92
Created June 2, 2016 09:34
Show Gist options
  • Save Digi92/22e37e4c15c9098813d5ec286f32aa23 to your computer and use it in GitHub Desktop.
Save Digi92/22e37e4c15c9098813d5ec286f32aa23 to your computer and use it in GitHub Desktop.
Map a array into a model with all sysmodels
<?php
$rows = array(
0 => array()
);
$className = 'Denkwerk\DwContentElements\Domain\Model\DownloadFileGroup';
/*** @var $extbaseObjectManager \TYPO3\CMS\Extbase\Object\ObjectManager */
$extbaseObjectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
/*** @var $dataMapper \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper */
$dataMapper = $extbaseObjectManager->get('TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper');
$model = $dataMapper->map($className, $rows);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment