Hi,
I have an ContentViewHelper to render single contents from table tt_content by uid.
Since TYPO3 10 ObjectManager is deprecated, I’m looking for a solution to replace $objectManager->get(…):
/**
* @param array $arguments
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
*/
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
)
{
$conf = [
'tables' => 'tt_content',
'source' => $arguments['uid'],
'dontCheckPid' => 1
];
$objectManager = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
return $objectManager->get('TYPO3\CMS\Frontend\ContentObject\RecordsContentObject')->render($conf);
}
This doesn’t work:
$cObject = GeneralUtility::makeInstance('TYPO3\CMS\Frontend\ContentObject\RecordsContentObject');
return $cObject->render($conf);
and leads to this exception:
Too few arguments to function TYPO3\CMS\Frontend\ContentObject\AbstractContentObject::__construct(), 0 passed in /html/typo3/typo3_src-10.4.32/typo3/sysext/core/Classes/Utility/GeneralUtility.php on line 3496 and exactly 1 expected
Can anyone help?