[TYPO3-mvc] Scheduler - Extbase repository
Peter Falk
pefalk at gmail.com
Mon Jul 8 18:50:50 CEST 2013
In article
<mailman.1.1373264466.31567.typo3-project-typo3v4mvc at lists.typo3.org>,
Domi <djgarms at gmail.com> wrote:
> On 07/07/13 19:05, Peter Falk wrote:
> > Hi group.
> >
> > I'm trying to get an instance of a repository from within the execute
> > function of a scheduler task.
> >
> > Below is what I've done - with no luck. Don't know what i'm missing, but
> > hope someone can help.
> >
> >
> > $this->objectManager =
> > \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase
> > \\Object\\ObjectManager');
> >
> > $this->mediaRepository =
> > $this->objectManager->get('TYPOCONSULT\\TcMediaPlayer\\Domain\\Repository
> > \\MediaRepository');
> >
> > The objectManager instance is ok, but the mediaRepository instance is
> > NULL
> >
> > Regards
> > Peter
> >
> Hi Peter,
>
> did you create your scheduler extension through CommandController
> (extends CommandController)? The CommandController injects the
> objectManager already, you shouldn't re-instantiate it.
> $mediaRepository =
> $this->objectManager->get('TYPOCONSULT\\TcMediaPlayer\\Domain\\Repository\\Med
> iaRepository')
> should work, otherwise there is a naming/namespace conflict. But as you
> propably don't make any use of DI inside of your MediaRepository class,
> you could simply use the GeneralUtility::makeInstance for getting the
> MediaRepository object.
>
> Cheers,
> Dominic
Thanks Dominic.
It was really a great help - just what I needed to move on.
This was what I needed to make it work:
$configurationManager =
$this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\Configurat
ionManager');
$settings =
$configurationManager->getConfiguration(ConfigurationManagerInterface::CO
NFIGURATION_TYPE_SETTINGS,
'extensionKey', 'pluginName');
$extbaseFrameworkConfiguration =
$configurationManager->getConfiguration(ConfigurationManagerInterface::CO
NFIGURATION_TYPE_FRAMEWORK,
'extensionKey', 'pluginName');
$configurationManager->setConfiguration($extbaseFrameworkConfiguration);
module.tx_yourExtension < plugin.tx_yourExtension
Regards
Peter
More information about the TYPO3-project-typo3v4mvc
mailing list