I forked the extension sf_event_mgt and created some schedulertasks.
If i call execute() with an userFunc in frontend or start the task manually all works fine. But if i call the schedulertask by cronjob with /var/www/[...]/cli_dispatcher.phpsh scheduler i always get
Call to a member function getParentKeyFieldName() on null in /var/www/[...]/vendor/typo3/cms/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php:447
The error seems to occur directly after instantiating these objects:
$this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$this->eventRepository = $this->objectManager->get(EventRepository::class);
$this->notificationService = $this->objectManager->get(NotificationService::class);
After commenting out the repository line, no exception is shown.
I already cleared all caches and checked php annotations.
Used PHP Version: 7.1.17 and TYPO3 Version: 7.6.30