[TYPO3-mvc] adding objects inside loop

Pieter Geurts - Aleto Internet pieter at aleto.nl
Fri Nov 5 12:33:24 CET 2010


Hello,
Why is the code below now working properly, it will only save the last 
banner inside the loop. Tried putting the persistAll() inside the loop, 
that made no difference

$groupArray = $this->request->getArgument('grouping');

         foreach($groupArray AS $key=>$value)
         {

         $group[$key] = $this->groupingRepository->findByUid($key);
         $group[$key]->addBanner($newBanner);
         }

     $persistenceManager = Tx_Extbase_Dispatcher::getPersistenceManager();
         $persistenceManager->persistAll();

grtz

Pieter


More information about the TYPO3-project-typo3v4mvc mailing list