[TYPO3-mvc] Persistene problem with new objects from form inputs

Michael Knoll mimi at kaktusteam.de
Tue Dec 22 16:41:28 CET 2009


Hi Robert,

thanks a lot - it works... will write about it on my blog :-)

Greetings and "Fröhliche Weihnachten!"

Michael



Robert Böttner schrieb:
> Hi Michael
> 
> try this:
> 
> 	/**
> 	 * Adds a new album to repository
> 	 *
> 	 * @param Tx_Yag_Domain_Model_Album $newAlbum  New album to add
> 	 * @return string  The rendered create action
> 	 */
> 	public function createAction(Tx_Yag_Domain_Model_Album 			
>          $newAlbum, Tx_Yag_Domain_Model_Gallery $gallery = NULL) {
> 		$this->albumRepository->add($newAlbum);
> 		if ($gallery != NULL) {
> 			$gallery->addAlbum($newAlbum);
> 		}
> 
> $persistenceManager = t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager');
> /* @var $persistenceManager Tx_Extbase_Persistence_Manager */
> $persistenceManager->persistAll();
> 
> 		$this->flashMessages->add('Your new album was
>                  created.');
> 		$this->redirect('index','Album', NULL, array('album' =>
>                  $newAlbum, 'gallery' => $gallery));
> 	}
> 
> Cheers
> Robert


More information about the TYPO3-project-typo3v4mvc mailing list