I have a service class in my Extbase extension and want to use the ObjectManager to create an instance of an object in the constructor.
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
* @inject
*/
protected $objectManager;
public function __construct() {
$this->standaloneView = $this->objectManager->get('TYPO3\CMS\Fluid\View\StandaloneView');
$this->standaloneView->setFormat('html');
}
Unfortunately this doesn't fails with an error Call to a member function get() on null
because the injected class doesn't seem to be available in the constructor. How can I use an injected class in the constructur?