[TYPO3-mvc] How to use the repository within a hook?

S.Korth s.korth at dms-arts.com
Thu Aug 12 10:48:10 CEST 2010


Hey Steffen,

my problem was that i didn't get any Objects with xy->findAll(). After
Christian told me that extbase needs the StorageID, i use the following 
in the repository:
$query->getQuerySettings()->setRespectStoragePage(false);

That works so far.

Now i need to update/delete some Objects. But why does the Update work 
for you? The Update function also uses the "findBy...", or !?!


Now iam confused, sorry :-(

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