[TYPO3-mvc] How to use the repository within a hook?
Steffen Ritter
info at rs-websystems.de
Thu Aug 12 10:16:19 CEST 2010
Am 12.08.2010 10:09, schrieb S.Korth:
> Hey all,
>
> sorry that's my X Question/Answer on this topic, but i need to know
> something. I understand that if i want to use xy->findAll() i need to
> build my own query within the repository, because of the missing Storage
> ID ($query->getQuerySettings()->setRespectStoragePage(false);)
>
> But how to update or delete an Object? At the moment i uses the "old"
> way. How to use Extbase for that,too ?
>
> Thanks
> Sascha
well I'm using Extbase within scheduler, and update add and else works
fine.... just $repository->add() or ->update();
$dispatcher = t3lib_div::makeInstance("Tx_Extbase_Dispatcher");
$videoRepository =
t3lib_div::makeInstance('Tx_Rsmysherpasprojects_Domain_Repository_VideoRepository');
notActivated = $videoRepository->findPending();
foreach($notActivated as $video) {
if($fliqzAPI->isProcessingFinished($video->getVideoId())) {
$video->setProcessed(TRUE);
$videoRepository->update($video);
}
}
but make shure to call manually
Tx_Extbase_Dispatcher::getPersistenceManager()->persistAll();
at the end.
That's all you have to do ;)
regards
More information about the TYPO3-project-typo3v4mvc
mailing list